如何使用PySolr的facet - 似乎无法获得facet结果(How to use facets with PySolr - can't seem to get facet results to show)
(我已经看到了类似的问题 - 但似乎无法解决为什么以下不起作用!)
嗨,我有一个正在运行的本地solr实例,并进行以下调用(通过浏览器中的url框):
http://localhost:8983/solr/select?q=video&rows=0&facet=true&facet.field=q_date
并得到以下结果(见结果1)。 然后我尝试与Python / PySolr等效:
solr = pysolr.Solr('http://localhost:8983/solr/', timeout=10) params = { 'facet': 'true', 'facet.field': 'q_date', 'rows': '0', } results = solr.search('video', **params)
似乎没有结果(如果我做'行':10然后我得到10个结果) - 但无论如何我似乎没有任何方面。
任何想法如何解决这个问题? 在我想出这个之后,我也希望使用StatsComponent功能(例如&stats = true&stats.field = q_visits)
提前致谢
结果1:
<response> <lst name="responseHeader"> <int name="status">0</int> <int name="QTime">2</int> <lst name="params"> <str name="facet">true</str> <str name="q">video</str> <str name="facet.field">q_date</str> <str name="rows">0</str> </lst> </lst> <result name="response" numFound="670" start="0"/> <lst name="facet_counts"> <lst name="facet_queries"/> <lst name="facet_fields"> <lst name="q_date"> <int name="2013-03-31T00:00:00Z">135</int> <int name="2013-01-31T00:00:00Z">121</int> <int name="2012-10-31T00:00:00Z">113</int> <int name="2013-02-28T00:00:00Z">112</int> <int name="2012-11-30T00:00:00Z">107</int> <int name="2012-12-31T00:00:00Z">82</int> </lst> </lst> <lst name="facet_dates"/> <lst name="facet_ranges"/> </lst> </response>
(I have seen similar questions to this - but cannot seem to resolve why the below doesnt work!)
Hi, I have a running local instance of solr and make the following call (via the url box in my browser):
http://localhost:8983/solr/select?q=video&rows=0&facet=true&facet.field=q_date
And get the results below (see results 1). Then I try the equivalent with Python/PySolr:
solr = pysolr.Solr('http://localhost:8983/solr/', timeout=10) params = { 'facet': 'true', 'facet.field': 'q_date', 'rows': '0', } results = solr.search('video', **params)
And seem to get no results (if I make 'rows': 10 then I get 10 results) - but in either case I seem to get no facets.
Any ideas how to get around this? After I figure this out I also wish to use the StatsComponent feature (e.g. &stats=true&stats.field=q_visits)
Thanks in advance
RESULTS 1:
<response> <lst name="responseHeader"> <int name="status">0</int> <int name="QTime">2</int> <lst name="params"> <str name="facet">true</str> <str name="q">video</str> <str name="facet.field">q_date</str> <str name="rows">0</str> </lst> </lst> <result name="response" numFound="670" start="0"/> <lst name="facet_counts"> <lst name="facet_queries"/> <lst name="facet_fields"> <lst name="q_date"> <int name="2013-03-31T00:00:00Z">135</int> <int name="2013-01-31T00:00:00Z">121</int> <int name="2012-10-31T00:00:00Z">113</int> <int name="2013-02-28T00:00:00Z">112</int> <int name="2012-11-30T00:00:00Z">107</int> <int name="2012-12-31T00:00:00Z">82</int> </lst> </lst> <lst name="facet_dates"/> <lst name="facet_ranges"/> </lst> </response>
原文:https://stackoverflow.com/questions/18704339
最满意答案
VARCHAR
是Pro * C预编译器添加的特殊类型,它不存在于基本C语言中。 但是,在C中,如果我没有弄错的话,您可以将VARCHAR
变量作为结构访问。The
VARCHAR
is a special type added by the Pro*C pre-compiler, it doesn't exist in the base C language. However, in C you can access aVARCHAR
variable as a structure if I'm not mistaken.
相关问答
更多-
这里的区别是 char *s = "Hello world"; 将会将"Hello world"放在内存的只读部分中 ,并使其成为一个指针,使得这个内存上的任何写入操作都是非法的。 在做: char s[] = "Hello world"; 将文字字符串放在只读存储器中,并将该字符串复制到堆栈上新分配的内存。 这样做 s[0] = 'J'; 法律。 The difference here is that char *s = "Hello world"; will place "Hello world ...
-
VARCHAR是可变长度的。 CHAR是固定长度。 如果你的内容是一个固定的大小,你会得到更好的性能与CHAR 。 有关详细说明,请参阅有关CHAR和VARCHAR类型的MySQL页面(请务必阅读注释)。 VARCHAR is variable-length. CHAR is fixed length. If your content is a fixed size, you'll get better performance with CHAR. See the MySQL page on CHAR an ...
-
只是为了清除...或总结... nchar和nvarchar可以存储Unicode字符。 char和varchar 不能存储Unicode字符。 char和nchar是固定长度 ,它将为您指定的字符数预留存储空间 ,即使您没有占用所有空间。 varchar和nvarchar是可变长度 ,只能为您存储的字符使用空格。 它不会预留像char或nchar这样的存储空间 。 nchar和nvarchar将占用存储空间的两倍,所以只有在需要Unicode支持的情况下才可以使用它们。 Just to clear up. ...
-
sqlplus中varchar(10)和varchar(10 char)之间的区别(Difference between varchar(10) and varchar ( 10 char) in sqlplus)[2022-12-27]
不同之处是: varchar(10 CHAR)是静态的,总是使用10个空格。 varchar(10)是动态的,只会使用他需要的空间。 我几乎在所有情况下都使用varchar(x) 。 如果您确定单元格总是具有相同数量的varchar(x CHAR)可以使用varchar(x CHAR) 。 The difference is: varchar(10 CHAR) is static and will use always 10 spaces. varchar(10) is dynamic and will o ... -
你问的是两种不同的语言,但在这方面,两者的答案(或多或少)是相同的。 你真的应该决定你正在使用哪种语言。 区别: 他们是不同的类型 它的实现定义了char是有符号还是无符号 相似点: 它们都是整数类型 它们的大小相同(一个字节,至少8位) 如果您只是使用它们来传输原始字节值,而不使用算术,则没有实际的区别。 You're asking about two different languages but, in this respect, the answer is (more or less) the sa ...
-
char*是指向char的指针, char **是指向char的指针。 char *ptr; 不为字符分配内存,它为指向char的指针分配内存。 char arr[10]; 分配10个字符, arr保存第一个字符的地址。 (尽管arr不是一个指针(不是char * ),而是char[10]类型) 用于演示: char *str = "1234556"; 就好像: char *str; // allocate a space for char pointer on the stack str ...
-
varchar2(n)和varchar2(n char)之间的Oracle SQL区别(Oracle SQL difference between varchar2(n) and varchar2(n char))[2022-07-19]
基于此资源 Oracle9i及更高版本允许将Varchar2列定义为多个字节VARCHAR2(50 BYTE)或多个字符VARCHAR2(50 CHAR), 后者在数据库转换为运行双字节字符集 (例如作为日语),您不必编辑列大小。 默认度量(通常为BYTE)使用nls_length_semantics设置。 如果您创建一个列为Varchar2(50)但只存储10个字节,那么Oracle将只保存10个字节到光盘。 这并不意味着您应该只创建Varchar2(4000)列,以防万一需要空间',这是一个非常糟糕的想 ... -
他们是一样的: C11§6.7.9初始化 字符类型数组可以由字符串文字或UTF-8字符串文字初始化, 可选地用大括号括起来。 字符串文字的连续字节(如果有空间或数组大小未知,则包括终止空字符)初始化数组的元素。 They are the same: C11 §6.7.9 Initialization An array of character type may be initialized by a character string literal or UTF−8 string literal, opti ...
-
在Pro * C语言中,VARCHAR和char之间有什么区别(In Pro*C language, what is the difference between VARCHAR and char)[2022-02-17]
VARCHAR是Pro * C预编译器添加的特殊类型,它不存在于基本C语言中。 但是,在C中,如果我没有弄错的话,您可以将VARCHAR变量作为结构访问。 The VARCHAR is a special type added by the Pro*C pre-compiler, it doesn't exist in the base C language. However, in C you can access a VARCHAR variable as a structure if I'm not ... -
正如你所说,varchar是可变长度的,而char是固定的。 但主要区别在于它使用的字节。 例。 列:用户名类型:char(10) 如果您的列用户名为'test',则它将使用10个字节。 它会有空间。 '测试______' 因此,varchar列将仅使用您使用的字节。 对于'test',它只使用4个字节。 你的数据将是 '测试' 谢谢。 As you said varchar is variable-length and char is fixed. But the main difference is t ...