lucene.net

How To Delete a Document using indexWriter in LuceneNet

…衆ロ難τιáo~ 提交于 2019-12-07 08:55:12
问题 I have this method that I invoke in my controller that have to delete a specific Document. I read in some articles that the best way to delete a Document is using a IndexWriter. But I can't make it work. This is my code My Index: var article1 = new Document(); article1.Add(new Field("Id", "1", Field.Store.YES, Field.Index.ANALYZED)); article1.Add(new Field("Author", "Author", Field.Store.YES, Field.Index.ANALYZED)); article1.Add(new Field("Title", "Title", Field.Store.YES, Field.Index

How to create more complex Lucene query strings?

老子叫甜甜 提交于 2019-12-07 05:20:41
问题 This question is a spin-off from this question. My inquiry is two-fold, but because both are related I think it is a good idea to put them together. How to programmatically create queries. I know I could start creating strings and get that string parsed with the query parser. But as I gather bits and pieces of information from other resources, there is a programattical way to do this. What are the syntax rules for the Lucene queries? --EDIT-- I'll give a requirement example for a query I

Why is this Lucene query a “contains” instead of a “startsWith”?

为君一笑 提交于 2019-12-07 04:51:18
问题 string q = "m"; Query query = new QueryParser("company", new StandardAnalyzer()).Parse(q+"*"); will result in query being a prefixQuery :company:a* Still I will get results like "Fleet Africa" where it is rather obvious that the A is not at the start and thus gives me undesired results. Query query = new TermQuery(new Term("company", q+"*")); will result in query being a termQuery :company:a* and not returning any results. Probably because it interprets the query as an exact match and none of

Calculate the score only based on the documents have more occurance of term in lucene

生来就可爱ヽ(ⅴ<●) 提交于 2019-12-07 04:38:25
问题 I am started working on resume retrieval(document) component based on lucene.net engine. It works great, and it fetches the document and score it based on the the idea behind the VSM is the more times a query term appears in a document relative to the number of times the term appears in all the documents in the collection, the more relevant that document is to the query. Lucene's Practical Scoring Function is derived from the below. score(q,d)=coord(q,d)·queryNorm(q)· ∑( tf(t in d) ·idf(t)2 ·

NHibernate + SqlServer full text search

纵然是瞬间 提交于 2019-12-07 04:03:12
问题 I have to do Full text search in NHibernate For following operation previously I am using Lucene.Net I have a table called candidate For full text query Lucene will return all candidate Id from lucene index and form that id I put in query in candidate and return the result But the problem is there is more than 10 Lack of candidate resume available so Lucene is very slow because filter value from 10 Lk row and put return value for in query against candidate and again filter candidate is taking

Why is Lucene.Net indexer throwing a System.IO.IOException was unhandled?

大兔子大兔子 提交于 2019-12-07 03:36:04
问题 The exception is thrown up at times saying the file write.lock cannot be used as it is being used by another process, however this is a very simple test app for Lucene.Net and there's no other process using it, any idea of how this may be The exception details are as follows: System.IO.IOException was unhandled HResult=-2147024864 Message=The process cannot access the file 'c:\temp\luceneidx\write.lock' because it is being used by another process. Source=mscorlib StackTrace: at System.IO._

Sitecore Search Predicate Builder multiple keyword search with boosting not working as desired

徘徊边缘 提交于 2019-12-07 00:34:39
问题 I have sitecore pages / lucene documents with the following fields: Title Filename Content File Contents I'm creating a search for these and have the following requirements: Hits containing the whole phrase in the title field should be returned first. Hits containing the whole phrase in the filename field should be returned second. Hits containing the whole phrase in the content should be returned third Hits containing the whole phrase in the file contents should be returned fourth Hits

Lucene .net Boost not working when using * wildcard

血红的双手。 提交于 2019-12-06 23:31:03
问题 I have two documents and using Luke to investigate, I have confirmed in code that it has the same behavior, using StandardAnalyzer . Document one with boost 1 stored/uncompressed,indexed,tokenized<Description:Nummer ett> stored/uncompressed,indexed,tokenized<Id:2> stored/uncompressed,indexed,tokenized<Name:Apa> Document two with boost 2 stored/uncompressed,indexed,tokenized<Description:Nummer två> stored/uncompressed,indexed,tokenized<Id:1> stored/uncompressed,indexed,tokenized<Name:Apa>

PhraseQuery against title field and QueryParser against a catch all field do not result in the results I expect

老子叫甜甜 提交于 2019-12-06 17:04:24
问题 If a user enters a phrase in the search box (with or without quotes), I want the results that show first be the documents that have the exact phrase in the document title, and other documents showing after it. This is what I have tried but it fails to give me the search results in that order: During indexing I say: AddStringFieldToDocument(document, "keyWord", this.BuildKeywordsString(), Field.Store.NO, Field.Index.ANALYZED, false); AddStringFieldToDocument(document, "title", this.Title,

Is the order of multi-valued fields in Lucene stable?

回眸只為那壹抹淺笑 提交于 2019-12-06 15:20:42
Suppose I add several values to a Document under the same field name: doc.Add( new Field( "tag", "one" ) ); doc.Add( new Field( "tag", "two" ) ); doc.Add( new Field( "tag", "three" ) ); doc.Add( new Field( "tag", "four" ) ); If I then later retrieve these fields from a new instance of Document (from a search result), am I guaranteed that the order of the Field s in the array will remain the same? Field[] fields = doc.GetFields( "tag" ); Debug.Assert( fields[0].StringValue() == "one" ); Debug.Assert( fields[1].StringValue() == "two" ); Debug.Assert( fields[2].StringValue() == "three" ); Debug