lucene.net

Optimizing Lucene performance

亡梦爱人 提交于 2019-11-27 05:17:09
问题 What are the various ways of optimizing Lucene performance? Shall I use caching API to store my lucene search query so that I save on the overhead of building the query again? 回答1: Have you looked at Lucene Optimization Tip: Reuse Searcher Advanced Text Indexing with Lucene Should an index be optimised after incremental indexes in Lucene? 回答2: Quick tips: Keep the size of the index small. Eliminate norms, Term vectors when not needed. Set Store flag for a field only if it a must. Obvious, but

Leading wildcard character throws error in Lucene.NET

六眼飞鱼酱① 提交于 2019-11-27 04:47:42
问题 If the search query contains a leading wildcard character ( * or ? ), the QueryParser 's Parse function throws an error. Dim q As String = "*abc" Dim qp As New QueryParser("text", New StandardAnalyzer()) Dim query As Query = qp.Parse(q) Is there any way to solve this problem in Lucene.NET v2.0.0.4? 回答1: Set QueryParser.SetAllowLeadingWildcard Method to true. The API page states that "this can produce very slow queries on big indexes" though. 回答2: Maybe you have to use a WildcardQuery, but ..

Synonyms using Lucene

元气小坏坏 提交于 2019-11-27 01:37:33
问题 What is the best way to handle synonyms (phrases) using Lucene? Especially, when I need to execute queries like :a OR b OR c NOT d How about adding a new field called "synonyms" to each document while indexing? This field's value would have a list of all synonyms. It would be added to a document only when that document has any of the synonyms. I would then execute an "OR" search query which would look for search keyword in this field along with other fields. Can this approach work well for

Configure Lucene.Net with SQL Server

南楼画角 提交于 2019-11-26 23:31:08
Has anyone used Lucene.NET rather than using the full text search that comes with sql server? If so I would be interested on how you implemented it. Did you for example write a windows service that queried the database every hour then saved the results to the lucene.net index? Nic Wise Yes, I've used it for exactly what you are describing. We had two services - one for read, and one for write, but only because we had multiple readers. I'm sure we could have done it with just one service (the writer) and embedded the reader in the web app and services. I've used lucene.net as a general database

Lucene query fails with mixed MUST/MUST_NOT

馋奶兔 提交于 2019-11-26 16:55:49
问题 Given a document with this text, indexed in a field named Content: The dish ran away with the spoon. The following query fails to match that document: +Content:dish +(-Content:xyz) <-- no results! I want the query to be treated as must include "dish", must not include "xyz" . It's the "must not" part that is failing. I know the +- combination looks funny but syntactically it should be correct, especially considering that the following variations all work: +Content:dish +(-Content:xyz +Content

Is it possible to iterate through documents stored in Lucene Index?

泄露秘密 提交于 2019-11-26 12:43:19
问题 I have some documents stored in a Lucene index with a docId field. I want to get all docIds stored in the index. There is also a problem. Number of documents is about 300 000 so I would prefer to get this docIds in chunks of size 500. Is it possible to do so? 回答1: IndexReader reader = // create IndexReader for (int i=0; i<reader.maxDoc(); i++) { if (reader.isDeleted(i)) continue; Document doc = reader.document(i); String docId = doc.get("docId"); // do something with docId here... } 回答2:

Problem using same instance of indexSearcher for multiple requests

不羁的心 提交于 2019-11-26 11:38:33
问题 Am using Lucene API in a .net web application. I want to use the same instance of Indexsearcher for all the requests.Hence am storing indexsearcher instance in http cache. here is my code for the same: if (HttpRuntime.Cache[\"IndexSearcher\"] == null) { searcher = new IndexSearcher(jobIndexFolderPath); HttpRuntime.Cache[\"IndexSearcher\"] = searcher; } else { searcher = (IndexSearcher)HttpRuntime.Cache[\"IndexSearcher\"]; } When I execute the statement below, I get a runtime error :\"Object