lucene.net

How to implement search with multiple filters using lucene.net

▼魔方 西西 提交于 2019-11-29 10:28:27
问题 I'm new to lucene.net. I want to implement search functionality on a client database. I have the following scenario: Users will search for clients based on the currently selected city. If the user wants to search for clients in another city, then he has to change the city and perform the search again. To refine the search results we need to provide filters on Areas (multiple), Pincode, etc. In other words, I need the equivalent lucene queries to the following sql queries: SELECT * FROM

Lucene.Net: How can I add a date filter to my search results?

不羁岁月 提交于 2019-11-29 09:36:33
问题 I've got my searcher working really well, however it does tend to return results that are obsolete. My site is much like NerdDinner whereby events in the past become irrelevant. I'm currently indexing like this note: my example is in VB.NET, but I don't care if examples are given in C# Public Function AddIndex(ByVal searchableEvent As [Event]) As Boolean Implements ILuceneService.AddIndex Dim writer As New IndexWriter(luceneDirectory, New StandardAnalyzer(), False) Dim doc As Document = New

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

≯℡__Kan透↙ 提交于 2019-11-29 04:41:55
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'm looking for is 5 . bajafresh4life This is Lucene Java, but should work for Lucene.NET: List docIds =

Lucene.net range queries + highlighting

强颜欢笑 提交于 2019-11-29 04:40:43
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 | --------------------------------------------------------- | 1317809284 | programmers are crazy | --------------------------------------------------

Solr Index appears to be valid - but returns no results

ⅰ亾dé卋堺 提交于 2019-11-29 01:38:48
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 searching for. So I am confused what I am doing wrong. Mauricio Scheffer Probably you don't have a

How to enable stemming when searching using lucene.net?

非 Y 不嫁゛ 提交于 2019-11-29 00:35:47
问题 How to enable stemming when searching using lucene.net? 回答1: To do this you need to write your own analyzer class. This is relatively straightforward. Here is the one that I am using. It combines stop word filtering. Porter stemming and (this may be too much for your needs) stripping of accents from characters. /// <summary> /// An analyzer that implements a number of filters. Including porter stemming, /// Diacritic stripping, and stop word filtering. /// </summary> public class

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

两盒软妹~` 提交于 2019-11-28 23:24:47
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 bad to the index. But, it's safe at the cost of just one object having a lock on the index at one time.

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

杀马特。学长 韩版系。学妹 提交于 2019-11-28 21:33:26
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*) does not match: Orchestra We want the first and the second one to both match Orchestra . Basically I

How do you implement a custom filter with Lucene.net?

流过昼夜 提交于 2019-11-28 18:56:54
The code below is from the Lucene In Action book (originally in Java). It's for building a list of 'allowed' documents (from a user permission point of view) to filter search results with. The problem is the termsDocs.Read() method does not accept the 'doc' and 'freq' arrays to be passed by reference, so they're still empty when it comes to setting the bit in the bit array. Can anyone help, examples of using Lucene custom filters (especially in .net) seem to be thin on the ground. Thanks. public class LuceneCustomFilter : Lucene.Net.Search.Filter { string[] _luceneIds; public

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

不问归期 提交于 2019-11-28 17:07:40
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 Lucene.Net.Analysis.Standard.StandardAnalyzer(); public static IndexWriter writer = new IndexWriter