lucene.net

Lucene Search for documents that have a particular field?

跟風遠走 提交于 2019-12-04 14:33:01
Lucene.Net - Is there a way to query for documents that contain a particular field. Lets say some of my documents have a field 'foo' and some do not. I want to find all documents that have the field 'foo' - regardless of what the value of foo is. How do I do this? Is it some sort of TermQuery? Try foo:[* TO *] should work for all non-null values of field 'foo' 来源: https://stackoverflow.com/questions/2686033/lucene-search-for-documents-that-have-a-particular-field

Implementing Solr with .net web application

时光毁灭记忆、已成空白 提交于 2019-12-04 13:57:42
问题 I'm about to implement Solr for search on NopCommerce based cart application. I would like to have an idea on the steps as how should I proceed with this. I have looked google for some help, but it didn't really helped. I found that there is an interface for .net for integrating this with .net applications, but not found any doc or tutorial on solr site. I need your help in deciding the best approach to address this problem. 回答1: There is a Solr Tutorial on the Solr Site. And as far as

Correctly indexing latitude and longitude values in Lucene

故事扮演 提交于 2019-12-04 12:32:52
问题 Am working on a "US based nearest city search within a given radius" functionality using Lucene API. Am indexing city's lat and long values in Lucene as follows: doc.Add(new Field("latitude", paddedLatitude, Field.Store.YES, Field.Index.UN_TOKENIZED)); doc.Add(new Field("longitude", paddedLongitude, Field.Store.YES, Field.Index.UN_TOKENIZED)); Since Lucene only understands strings and not numbers, am padding lat and long values. For example, if original lat and long are 41.811846 and -87

Finding exact match using Lucene search API

徘徊边缘 提交于 2019-12-04 12:12:25
问题 I'm working on a company search API using Lucene. My Lucene company index has got 2 companies: 1.Abigail Adams National Bancorp, Inc. 2.National Bancorp If the user types in National Bancorp, then only company # 2(ie. National Bancorp) should be returned and not #1.....ie. only exact matches should be returned. How do I achieve this functionality? Thanks for reading. 回答1: You can use KeywordAnalyzer to index and search on this field. Keyword Analyzer will generate only one token for the

How can I use Lucene's PriorityQueue when I don't know the max size at create time?

▼魔方 西西 提交于 2019-12-04 11:48:53
I built a custom collector for Lucene.Net, but I can't figure out how to order (or page) the results. Everytime Collect gets called, I can add the result to an internal PriorityQueue, which I understand is the correct way to do this. I extended the PriorityQueue, but it requires a size parameter on creation. You have to call Initialize in the constructor and pass in the max size. However, in a collector, the searcher just calls Collect when it gets a new result, so I don't know how many results I have when I create the PriorityQueue . Based on this, I can't figure out how to make the

How to index Word 2003, 2007 and 2010 documents using Lucene.NET

旧城冷巷雨未停 提交于 2019-12-04 09:40:01
问题 I am writing a custom Lucene.NET indexer to enable indexing of MS Word documents. The indexer must be capable of handling last three releases of MS Word: 2010, 2007 and 2003. The plan is to use VSTO interop assemblies that are installed as part of VS2010 to extract text content from the documents. Is there a better way to implement Word document indexing? Does this mean I will have to install all three versions of Word on the server? Or just Word 2010? Tools/Environment: Lucene.NET 2.3.1.3

Storing words with apostrophe in Lucene index

若如初见. 提交于 2019-12-04 09:18:33
I've a company field in Lucene Index. One of the company names indexed is : Moody's When user types in any of the following keywords,I want this company to come up in search results. 1.Moo 2.Mood 3.Moodys 4.Moody's How should I store this index in Lucene and what type of Lucene Query should I use to get this behaviour? Thanks. Yuval F Based on your clarifications, I want to divide your question into two, and answer each in turn: How do I index words with apostrophes as equivalent to similar words without an apostrophe? e.g. mapping Moodys and Moody's to the same index term. How do I implement

MultiFieldQueryParser is removing dots from the acronym

好久不见. 提交于 2019-12-04 06:22:40
问题 Am posting this question again as my query is not answered. Am working on a book search api using Lucene. User can search for a book whose title or description field contains C.F.A... Am using StandardAnalyzer alongwith a list of stop words. Am using MultiFieldQueryParser for parsing above string.But after parsing, its removing the dots in the string. What am i missing here? Thanks. 回答1: As you mentioned, this is a dupe of this question. I suggest you at least add a link to it in your

Getting terms matched in a document when searching using a wildcard search

丶灬走出姿态 提交于 2019-12-04 03:03:14
I am looking for a way to find the terms that matched in the document using waldcard search in Lucene. I used the explainer to try and find the terms but this failed. A portion of the relevant code is below. ScoreDoc[] myHits = myTopDocs.scoreDocs; int hitsCount = myHits.Length; for (int myCounter = 0; myCounter < hitsCount; myCounter++) { Document doc = searcher.Doc(myHits[myCounter].doc); Explanation explanation = searcher.Explain(myQuery, myCounter); string myExplanation = explanation.ToString(); ... When I do a search on say micro*, documents are found and it enter the loop but

In lucene.net can we search for a content without giving field name..and it will search in all fields that are indexed?

余生长醉 提交于 2019-12-04 00:24:35
In lucene.net can we search for a content without giving field name..and it will search in all fields that are indexed. vijay shiyani You cannot search for content without giving field name, however you can use MultiFieldQueryParser to search in all available fields. E.g Dim queryParser = New MultiFieldQueryParser(Version.LUCENE_29, _ indexReader__1.GetFieldNames(IndexReader.FieldOption.ALL).ToArray(), analyzer) here is complete an example. 'get index directory Dim directory As Directory = FSDirectory.Open(New DirectoryInfo(HostingEnvironment.MapPath(VirtualIndexPath))) 'get analyzer Dim