类文件常量池(javap)中的方法签名和描述符(Method signatures and descriptors in class file constant pool (javap))
我试图找出类文件中常量池部分下面的以下两个条目:
int foo(int x) { return x; } #11 = Utf8 foo #12 = Utf8 (I)I // 1 #13 = Utf8 x #14 = Utf8 I // 2
条目(1) - >(I)I表示函数的开始和条目(2) - > I表示函数的结束。
这个编译器是特定的还是可能因编译器而异?
Lambda函数也有类似的问题。
interface I { int foo(int x); } class X { I x = (int x1) -> 0; } #15 = Utf8 lambda$new$0 #16 = Utf8 (I)I #17 = Utf8 x1 #18 = Utf8 I
抱歉在JLS文档上找不到任何内容。
谢谢
I am trying to figure out the following two entries under the constant pool section in the class file:
int foo(int x) { return x; } #11 = Utf8 foo #12 = Utf8 (I)I // 1 #13 = Utf8 x #14 = Utf8 I // 2
Does the entry (1) -> (I)I denotes start of the function and the entry (2) -> I denotes end of function.
Is this compiler specific or could vary from one compiler to another?
Similar question for Lambda functions as well.
interface I { int foo(int x); } class X { I x = (int x1) -> 0; } #15 = Utf8 lambda$new$0 #16 = Utf8 (I)I #17 = Utf8 x1 #18 = Utf8 I
Sorry Could not find anything on JLS docs.
Thanks
原文:https://stackoverflow.com/questions/22990957
最满意答案
我担心思考狮身人面像是不可能的 - 至少,不是那么简单。 你可以做的是使用你想要搜索的对象,获取它们的ID,并在过滤器中使用它:
possible_children = @technique.possible_children(current_user) Technique.search params[:search], :with => {:sphinx_internal_id => possible_children.collect(&:id)}
Sphinx有自己的id,但是来自数据库的主键被Thinking Sphinx存储为属性
sphinx_internal_id
。I'm afraid this isn't possible with Thinking Sphinx - at least, not that simply. What you could do is use the objects you want to search across, grab their ids, and use that in a filter:
possible_children = @technique.possible_children(current_user) Technique.search params[:search], :with => {:sphinx_internal_id => possible_children.collect(&:id)}
Sphinx has its own id, but the primary key from the database is stored as the attribute
sphinx_internal_id
by Thinking Sphinx.
相关问答
更多-
您已经明确表示该值不能作为projects表中的列使用,而是在相关模型上? 如果是这样,那么您可以通过关联来引用它: has user.is_eligible, :as => :is_user_eligible 但是,如果它不是列,但可以在SQL查询的上下文中确定,那么您可以使用SQL片段作为属性定义(我知道我的例子是相当人为的,但应该给你一些想法): has "(users.foo = 'bar' || users.baz = 'qux')", :as => :is_user_eligible, ...
-
事实证明,这个问题与Thinking Sphinx如何处理Single Table Inheritance有关。 TS仅返回具有与父类的子类对应的type记录。 如果type为NULL ,则文档不包含在搜索结果中。 我们在accounts表中有很多type=NULL 。 修复数据后,搜索现在按预期工作。 感谢#sphinxsearch中的roman3x指向我。 It turns out the issue had to do with how Thinking Sphinx handles Single T ...
-
如何使用rspec测试Thinking Sphinx delta索引(How to test Thinking Sphinx delta indexes using rspec)[2021-02-15]
问题是由于https://github.com/pat/thinking-sphinx/issues/148 (在rspec测试用例中默认禁用delta索引) 我必须将以下标志设置为true才能运行测试用例: ThinkingSphinx.deltas_enabled = true ThinkingSphinx.updates_enabled = true Issue was due to https://github.com/pat/thinking-sphinx/issues/148 (delta ... -
在将数据发送到搜索之前,您可以在用户数据末尾附加星号吗? can you append an asterisk at the end of user data before sending it to search?
-
我不确定是否有一种优雅的方式来做到这一点,我很害怕。 我能想到的唯一选择是在你的索引定义中这样: (2008..Date.today.year).each do |year| has "SUM(CASE WHEN YEAR(posts.created_at) = #{year} THEN rating ELSE 0 END", as: "total_rating_for_#{year}".to_sym, type: :float end I'm not sure if there's an e ...
-
我不知道这是否会有所帮助。但是对于开放式移动,您可以编译任何源代码并将其安装到任何前缀。例如$ OPENSHIFT_RUNTIME_DIR。 我认为最好的方法就是创建一个DIY(自己动手)应用程序并编译源代码中的所有内容,或者创建一个Ruby应用程序并安装所需的宝石,根据需要修改环境。 本文可能会为您提供有关在开放式平台上从源安装应用程序的想法。 https://openshift.redhat.com/community/blogs/enabling-python-27-on-a-paas-with-th ...
-
思考Sphinx没有将相关数据索引到搜索到的模型(Thinking Sphinx not indexing associated data to model searched by)[2022-05-13]
问题与权限和Capistrano发布目录结构有关。 该服务由root拥有,从较旧版本运行,并且不会停止使用用户级别的rake ts:stop,它要求我以root身份运行它,然后从当前版本目录启动该服务。 此时,数据正在正确显示。 The problem had to do with permissions and the Capistrano release directory structure. The service was owned by root, was running from an old ... -
使用Thinking Sphinx搜索索引模型对象的集合(Searching through a collection of indexed model objects using Thinking Sphinx)[2021-09-19]
我担心思考狮身人面像是不可能的 - 至少,不是那么简单。 你可以做的是使用你想要搜索的对象,获取它们的ID,并在过滤器中使用它: possible_children = @technique.possible_children(current_user) Technique.search params[:search], :with => {:sphinx_internal_id => possible_children.collect(&:id)} Sphinx有自己的id,但是来自数据库的主键被T ... -
思维Sphinx没有内置任何东西来为多边形搜索提供一个整洁的界面,但它当然可以使用该功能。 您需要生成您想要的SphinxQL SELECT子句,相应地对其进行过滤,和/或您可以使用AttributesPane访问自定义AttributesPane 。 希望以下代码清楚: search = Model.search("foo", :select => "*, CONTAINS(GEOPOLY2D(...), ...) AS inside", :with => {:inside => true} ...
-
最简单的方法是为两个模型的索引添加一个属性: has "1", :as => :sort_order, :type => :integer 每个模型中字符串中的数字应该不同。 然后你的:order参数变为: :order => 'sort_order ASC, @relevance DESC' The easiest way is to add an attribute to both models' indices: has "1", :as => :sort_order, :type => :int ...