lucene.net

In a Lucene / Lucene.net search, how do I count the number of hits per document?

狂风中的少年 提交于 2019-11-27 18:30:34
问题 When searching a bunch of documents, I can easily find the number of documents which match my search criteria: Hits hits = Searcher.Search(query); int DocumentCount = hits.Length(); How do I determine the total number of hits within the documents? For example, let's say I search for "congress" and I get 2 documents back. How can I get the number of times "congress" occurs in each document? For example let's say "congress" occurs 2 times in document #1 and 3 times in document #2. The result I

Lucene.net range queries + highlighting

半世苍凉 提交于 2019-11-27 16:45:00
问题 Yet another Lucene.net question by an extreme newbie to it. This time, I have found an interesting issue with using a query that contains a range and using highlighting. I am writing this from memory, so please forgive any syntax errors. I have a hypothetical Lucene index of this: --------------------------------------------------------- | date | text | --------------------------------------------------------- | 1317809124 | a crazy block of text | --------------------------------------------

Solr Index appears to be valid - but returns no results

时光总嘲笑我的痴心妄想 提交于 2019-11-27 16:08:00
问题 Solr newbie here. I have created a Solr index and write a whole bunch of docs into it. I can see from the Solr admin page that the docs exist and the schema is fine as well. But when I perform a search using a test keyword I do not get any results back. On entering * : * into the query (in Solr admin page) I get all the results. However, when I enter any other query (e.g. a term or phrase) I get no results. I have verified that the field being queried is Indexed and contains the values I am

Does Lucene.Net manage multiple threads accessing the same index, one indexing while the other is searching?

五迷三道 提交于 2019-11-27 14:55:26
问题 When using Lucene.Net with ASP.NET, I can imagine that one web request can trigger an update to the index while another web request is performing a search. Does Lucene.Net have built in it the ability to manage concurrent access, or do I have to manage it, to avoid "being used by another process" errors? EDIT: After reading docs and experimentation, this is what I think I've learned: There are two issues, thread safety and concurrency. Multithreading is "safe" in that you can't do anything

Howto perform a 'contains' search rather than 'starts with' using Lucene.Net

…衆ロ難τιáo~ 提交于 2019-11-27 13:10:29
问题 We use Lucene.NET to implement a full text search on a clients website. The search itself works already but we now want to implement a modification. Currently all terms get appended a * which leads Lucene to perform what I would classify as a StartsWith search. In the future we would like to have a search that performs something like a Contains rather than a StartsWith . We use Lucene.Net 2.9.2.2 StandardAnalyzer default QueryParser Samples: (Title:Orch*) matches: Orchestra but: (Title:rch*)

Using Server.MapPath() inside a static field in ASP.NET MVC

China☆狼群 提交于 2019-11-27 10:12:09
问题 I'm building an ASP.NET MVC site where I'm using Lucene.Net for search queries. I asked a question here about how to properly structure Lucene.Net usage in an ASP.NET MVC application and was told that the best method is to declare the my IndexWriter as public static , so that it can be re-used. Here is some code that is at the top of my SearchController: public static string IndexLocation = Server.MapPath("~/lucene"); public static Lucene.Net.Analysis.Standard.StandardAnalyzer analyzer = new

How to incorporate multiple fields in QueryParser?

南笙酒味 提交于 2019-11-27 09:20:16
问题 Dim qp1 As New QueryParser("filename", New StandardAnalyzer()) Dim qp2 As New QueryParser("filetext", New StandardAnalyzer()) . . I am using the 'Lucene.Net' library and have the following question. Instead of creating two separate QueryParser objects and using them to obtain two Hits objects, is it possible perform a search on both fields using a single QueryParser object, so that I have only one Hits object which gives me the overall score of each Document? 回答1: There are 3 ways to do this.

Why is filter not working with text/string values in Lucene.Net?

不问归期 提交于 2019-11-27 08:39:46
问题 I have made a filter in Lucene.Net to limit the result of the search. I am encountering a very strange issue. The filter is not working with Text Values but working with number values. For Example: If I am making a filter with Number values something like below. It is working perfectly. String field = "id"; Filter LE= new QueryWrapperFilter(new TermQuery( new Term(field, "1234567"))); indexSearcher.Search(QueryMaker(searchString, searchfields), LE, coll); However, if I give a value containing

Search Engine - Lucene or Solr

≯℡__Kan透↙ 提交于 2019-11-27 06:14:00
We need to integrate a search engine in our Product Catalog management software. the catalog is expected to have more than 4-5 mn. records with relational data spread over several tables. Our dev platform is Asp.Net 3.5 and we have done some pre-liminary work on Lucene, found it to be good. However, we just came to know of Solr and was looking for some practical tips to compare Lucene & Solr from implementation, timeline, regular maintenance, performance, features perspective. Any guidance or pointers would be really helpful. Thanks. Lucene: Apache Lucene is a high-performance, full-featured

Problem using same instance of indexSearcher for multiple requests

我的梦境 提交于 2019-11-27 05:32:06
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 reference not set to an instance of an object." Hits hits = searcher.Search(myQuery); What am i missing here?