Solr筛选器查询-字符串与整数 [英] Solr Filter Query - String vs. Int
问题描述
说我要查询一堆具有类别的文档,并且我想将查询限制为指定的类别(据我了解,这只是使用fq参数(过滤器查询).
Say I'm trying to query a bunch of documents that have categories and I want to limit the queries to a specified category (as I understand it this would just be using the fq parameter (filter query).
我想知道参数是否为整数而不是字符串或其他类似数据的性能是否有所提高?我只是在右边犯了错误,但我想我会仔细检查一下,以防它没什么大不了的,而Solr在后台进行了某种优化?
I was wondering if there is a performance improvement for having the parameter be an integer instead of a string or something as is usually the case with data? I would just err on the right side but I thought I'd double check in case it didn't matter very much and Solr performed some sort of optimization under the hood?
如果我只过滤字符串匹配项,那将会更加方便.
It would be much more convenient if I could just filter on string matches but..
谢谢大家的提示
推荐答案
除非您需要执行范围查询(对此数字字段具有特殊支持)或排序(int字段高速缓存比String字段高速缓存效率更高) ),它们应该大致相等.
Unless you need to perform range queries (numeric fields have special support for this) or sorting (the int field cache is more memory-efficient than the String field cache), they should be roughly equivalent.
这篇关于Solr筛选器查询-字符串与整数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!