首页 \ 问答 \ 如何使用PySolr的facet - 似乎无法获得facet结果(How to use facets with PySolr - can't seem to get facet results to show)

如何使用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
更新时间:2023-09-10 09:09

最满意答案

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 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. ...
  • 不同之处是: 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 ...
  • 基于此资源 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 ...
  • 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 ...

相关文章

更多

最新问答

更多
  • 获取MVC 4使用的DisplayMode后缀(Get the DisplayMode Suffix being used by MVC 4)
  • 如何通过引用返回对象?(How is returning an object by reference possible?)
  • 矩阵如何存储在内存中?(How are matrices stored in memory?)
  • 每个请求的Java新会话?(Java New Session For Each Request?)
  • css:浮动div中重叠的标题h1(css: overlapping headlines h1 in floated divs)
  • 无论图像如何,Caffe预测同一类(Caffe predicts same class regardless of image)
  • xcode语法颜色编码解释?(xcode syntax color coding explained?)
  • 在Access 2010 Runtime中使用Office 2000校对工具(Use Office 2000 proofing tools in Access 2010 Runtime)
  • 从单独的Web主机将图像传输到服务器上(Getting images onto server from separate web host)
  • 从旧版本复制文件并保留它们(旧/新版本)(Copy a file from old revision and keep both of them (old / new revision))
  • 西安哪有PLC可控制编程的培训
  • 在Entity Framework中选择基类(Select base class in Entity Framework)
  • 在Android中出现错误“数据集和渲染器应该不为null,并且应该具有相同数量的系列”(Error “Dataset and renderer should be not null and should have the same number of series” in Android)
  • 电脑二级VF有什么用
  • Datamapper Ruby如何添加Hook方法(Datamapper Ruby How to add Hook Method)
  • 金华英语角.
  • 手机软件如何制作
  • 用于Android webview中图像保存的上下文菜单(Context Menu for Image Saving in an Android webview)
  • 注意:未定义的偏移量:PHP(Notice: Undefined offset: PHP)
  • 如何读R中的大数据集[复制](How to read large dataset in R [duplicate])
  • Unity 5 Heighmap与地形宽度/地形长度的分辨率关系?(Unity 5 Heighmap Resolution relationship to terrain width / terrain length?)
  • 如何通知PipedOutputStream线程写入最后一个字节的PipedInputStream线程?(How to notify PipedInputStream thread that PipedOutputStream thread has written last byte?)
  • python的访问器方法有哪些
  • DeviceNetworkInformation:哪个是哪个?(DeviceNetworkInformation: Which is which?)
  • 在Ruby中对组合进行排序(Sorting a combination in Ruby)
  • 网站开发的流程?
  • 使用Zend Framework 2中的JOIN sql检索数据(Retrieve data using JOIN sql in Zend Framework 2)
  • 条带格式类型格式模式编号无法正常工作(Stripes format type format pattern number not working properly)
  • 透明度错误IE11(Transparency bug IE11)
  • linux的基本操作命令。。。