使用 Apache SOLR 进行高级搜索
Advanced search with Apache SOLR
我在过滤数据时遇到问题。
我已经有一个包含每个产品尺寸的数据。
{"product_name":"new jeans","product_size_url":"27"},
{"product_name":"new sporty shoes ","product_size_url":"39"},
{"product_name":"new shoes ","product_size_url":"45"}
如何构建查询以显示包含大小为 27,45 的数据?
这个案子我真的需要帮助。
谢谢
您已经查询了每个产品的 returns 尺寸?如果您不希望尺寸查询影响查询的相关性分数,请使用过滤器查询 - fq
This parameter can be used to specify a query that can be used to restrict the super set of documents that can be returned, without influencing score. It can be very useful for speeding up complex queries since the queries specified with fq are cached independently from the main query
https://wiki.apache.org/solr/CommonQueryParameters#fq
所以你会这样查询
q=product_name:new&fq=product_size_url:(27 OR 45)
这将找到名称中包含单词 new 的所有产品,然后通过应用过滤器查询 product_size_url:(27 OR 45)
来限制超集
我在过滤数据时遇到问题。 我已经有一个包含每个产品尺寸的数据。
{"product_name":"new jeans","product_size_url":"27"},
{"product_name":"new sporty shoes ","product_size_url":"39"},
{"product_name":"new shoes ","product_size_url":"45"}
如何构建查询以显示包含大小为 27,45 的数据?
这个案子我真的需要帮助。 谢谢
您已经查询了每个产品的 returns 尺寸?如果您不希望尺寸查询影响查询的相关性分数,请使用过滤器查询 - fq
This parameter can be used to specify a query that can be used to restrict the super set of documents that can be returned, without influencing score. It can be very useful for speeding up complex queries since the queries specified with fq are cached independently from the main query
https://wiki.apache.org/solr/CommonQueryParameters#fq
所以你会这样查询
q=product_name:new&fq=product_size_url:(27 OR 45)
这将找到名称中包含单词 new 的所有产品,然后通过应用过滤器查询 product_size_url:(27 OR 45)