lucene

Searching for exact phrase

扶醉桌前 提交于 2020-01-15 12:07:24
问题 How do i achieve "Exact Phrase" functionality on this field using BooleanQuery/any other class? For example if a user types in "top selling book" then it should return books which has this phrase in its description. Thanks again! 回答1: Having the query within double quotes should work. 来源: https://stackoverflow.com/questions/431556/searching-for-exact-phrase

Solr case insensitve

泪湿孤枕 提交于 2020-01-15 12:06:18
问题 Hallo, I'am implementing an autocompletion feature in Solr and have one problem. For autocompletion I am using <fieldType name="text_auto" class="solr.TextField" sortMissingLast="true" omitNorms="true"> <analyzer> <tokenizer class="solr.KeywordTokenizerFactory"/> <filter class="solr.LowerCaseFilterFactory" /> </analyzer> </fieldType> I thought that the LowerCaseFilter should make the Token Case insensitiv but that ist wrong. In fact in just lowercases the Token which means that a query like

Solr case insensitve

末鹿安然 提交于 2020-01-15 12:04:34
问题 Hallo, I'am implementing an autocompletion feature in Solr and have one problem. For autocompletion I am using <fieldType name="text_auto" class="solr.TextField" sortMissingLast="true" omitNorms="true"> <analyzer> <tokenizer class="solr.KeywordTokenizerFactory"/> <filter class="solr.LowerCaseFilterFactory" /> </analyzer> </fieldType> I thought that the LowerCaseFilter should make the Token Case insensitiv but that ist wrong. In fact in just lowercases the Token which means that a query like

How to set ResponseWriter to non-default in Solr

那年仲夏 提交于 2020-01-15 11:49:07
问题 I have the following code, which is simply searching the Solr Server. SolrServer server = new CommonsHttpSolrServer(url); SolrQuery searchquery = new SolrQuery("company profile"); QueryResponse response = server.query(searchquery) I want to have the response in json, other than the default which is xml. So I went into the solrconfig.xml file and enabled the following line: <queryResponseWriter name="json" class="org.apache.solr.request.JSONResponseWriter" /> However, from the console, I'm

Exact field search with solr/lucene

感情迁移 提交于 2020-01-15 11:34:28
问题 I have text field. And for given query I want to find all documents that contains indexed field values. query.contains(document.field_name) Examples: 1. field_name:"a b" 2. field_name:"a b c" For query "a b d" I want to find only first item. Not efficient way to do this is basically generate all substrings of query and index field as a string. Is it possible to implements such requirements in Solr using existen functionality? If not what is the most efficient algorithm/way to do this? PS.

Exact field search with solr/lucene

妖精的绣舞 提交于 2020-01-15 11:34:25
问题 I have text field. And for given query I want to find all documents that contains indexed field values. query.contains(document.field_name) Examples: 1. field_name:"a b" 2. field_name:"a b c" For query "a b d" I want to find only first item. Not efficient way to do this is basically generate all substrings of query and index field as a string. Is it possible to implements such requirements in Solr using existen functionality? If not what is the most efficient algorithm/way to do this? PS.

How do I get the tf and idf score from a Solr query?

不羁岁月 提交于 2020-01-15 06:30:06
问题 Following Solr documentations (https://cwiki.apache.org/confluence/display/solr/Function+Queries and others) I should just put idf(fieldname, 'term') as I do with termfreq(fieldname, 'term') in the field list. However, whenever I try this I get an exception as: org.apache.solr.client.solrj.SolrServerException: No live SolrServers available to handle this request By looking at the logs I could find: null:java.lang.UnsupportedOperationException: requires a TFIDFSimilarity (such as

lucene中创建索引库

和自甴很熟 提交于 2020-01-15 01:57:18
package com.hope.lucene;import org.apache.commons.io.FileUtils;import org.apache.lucene.document.Document;import org.apache.lucene.document.Field;import org.apache.lucene.document.TextField;import org.apache.lucene.index.IndexWriter;import org.apache.lucene.index.IndexWriterConfig;import org.apache.lucene.store.Directory;import org.apache.lucene.store.FSDirectory;import org.junit.Test;import java.io.File;/** * @author newcityman * @date 2020/1/15 - 0:01 */public class LuceneFirst { @Test public void createIndex() throws Exception{ //1、创建一个Director对象,指定索引库保存的位置 //把索引库保存到磁盘 Directory directory =

How to get a better Lucene/Solr score if word queried was at the beginning of the indexed field?

纵饮孤独 提交于 2020-01-14 14:33:11
问题 I read at some point something explaining what to do to have Lucene/Solr give a better score if my queried word was found at the beginning of the description I indexed. Cannot find it anymore on the net. Anybody has the links handy ? Thank you. 回答1: Payloads could help you do that. Actually, payloads let you give an arbitrary boost to any token of your token stream, so you can boost depending on anything: the position in the stream, the font weight, whether the token contains capital letters,

JAVA课程笔记系列: 基于SpringBoot的Data Solr搜索引擎开发

佐手、 提交于 2020-01-14 12:22:21
基于SpringBoot的Data Solr搜索引擎开发 关于Apache Solr的简介 Solr它是一种开放源码的、基于 Lucene Java 的搜索服务器,易于加入到 Web 应用程序中。Solr 提供了层面搜索(就是统计)、命中醒目显示并且支持多种输出格式(包括XML/XSLT 和JSON等格式)。它易于安装和配置,而且附带了一个基于HTTP 的管理界面。可以使用 Solr 的表现优异的基本搜索功能,也可以对它进行扩展从而满足企业的需要。Solr的特性包括: 高级的全文搜索功能 专为高通量的网络流量进行的优化 基于开放接口(XML和HTTP)的标准 综合的HTML管理界面 可伸缩性-能够有效地复制到另外一个Solr搜索服务器 使用XML配置达到灵活性和适配性 可扩展的插件体系 支持像英语,德语,中国,日本,法国和许多主要语言 Apache Solr和Lucene的关系 Solr 与Lucene 并不是竞争对立关系,恰恰相反Solr 依存于Lucene ,因为Solr 底层的核心技术是使用Apache Lucene 来实现的,简单的说Solr 是Lucene 的服务器化。需要注意的是Solr 并不是简单的对Lucene 进行封装,它所提供的大部分功能都区别于Lucene。 Apache Solr 相关目录说明 Solr程序包的结构说明 bin :solr相关运行脚本