lucene.net

Lucene .NET search results

↘锁芯ラ 提交于 2019-12-13 13:27:17
问题 I'm using this code to index: public void IndexEmployees(IEnumerable<Employee> employees) { var indexPath = GetIndexPath(); var directory = FSDirectory.Open(indexPath); var indexWriter = new IndexWriter(directory, new StandardAnalyzer(Version.LUCENE_29), true, IndexWriter.MaxFieldLength.UNLIMITED); foreach (var employee in employees) { var document = new Document(); document.Add(new Field("EmployeeId", employee.EmployeeId.ToString(), Field.Store.YES, Field.Index.NO, Field.TermVector.NO));

Making Lucene.Net thread safe in the code

纵饮孤独 提交于 2019-12-13 08:06:02
问题 I am using Lucene.Net for Searching and wanted to know how I can handle this threading issue. I have a single instance of class Test, but the searcher is not threadsafe in this case, since the timer thread can update the index at the same time the request is served, and I do see exception due to that. Any pointers on how to make it thread safe. public class Test { private static object syncObj = new object(); private System.Threading.Timer timer; private Searcher searcher; private

Index Analyzed and not Analyzed?

喜夏-厌秋 提交于 2019-12-13 05:04:42
问题 I am using Lucene.net for indexing and searching in my application, I would like to offer NORMAL And Regular Expression Search to user but for normal search I need to index my document In Analyzed way and for regular expression I need to do it by Not Analyzed way, And I cant index same document twice to support both search type...help me Pravin thokal 回答1: I highly recommend you index the document twice: first as an analyzed field and second as a non-analyzed field. Redundancy is not a bad

IFullTextQuery - exception if there are too may objects

怎甘沉沦 提交于 2019-12-13 05:00:07
问题 This code works fine: Query query = parser.Parse(expression); IFullTextSession session = Search.CreateFullTextSession(this.Session); IFullTextQuery fullTextQuery = session.CreateFullTextQuery(query, new[] { typeof(MappedSequence) }); var l1 = fullTextQuery.List(); as long as the query does not return too many objects. If the query contains too many objects the generated sql code is too long and sql server throws an exception. One working solution is to obtain all objects using paging which is

Lucene Index and Query Design Question - Searching People

谁说胖子不能爱 提交于 2019-12-13 04:41:15
问题 I have recently just started working with Lucene (specifically, Lucene.Net) and have successfully created several indicies and have no problem with any of them. Previously having worked with Endeca, I find that Lucene is lightweight, powerful, and has a much lower learning curve (due mostly to a concise API). However, I have one specific index/query situation which I am having problems wrapping my head around. What I have is a person directory. People can be searched for in this application,

How to set up a query to return phrases and parts of phrases in lucene.net?

|▌冷眼眸甩不掉的悲伤 提交于 2019-12-13 04:15:11
问题 I've got lucene.net running and I am having a little trouble with implementing a good approach to a query requirement that I have. I'd like to be able to create a query that would enable the query to find hits on: 1) "Sodium Bicarbonate" - exact phrase query. 2) "Sodi% Bicarb%" - partial phrase query that at least has these letters. 3) "sodium, Sodium Bicarbonate , sulfur" - find exact phrase in a bigger phrase set with a form like 1) or 2). This query will be applied to two fields in the

SpanMultiTermQueryWrapper in Lucene.NET?

你离开我真会死。 提交于 2019-12-13 02:27:49
问题 Does anyone know if the SpanMultiTermQueryWrapper class is available in the Lucene.NET port? I can't find it anywhere, and it sure would be handy. I'm still using version 2.9...maybe it's available in a later version? Thanks! 回答1: I do not see it in the current codebase: https://svn.apache.org/repos/asf/incubator/lucene.net/trunk/src/core/Search/Spans/ You could probably port it easily enough though. 回答2: SpanMultiTermQueryWrapper is available on Lucene.Net 4.8.0-beta00004. If you need

sitecore 6.6 lucene version incompatibility

自闭症网瘾萝莉.ら 提交于 2019-12-12 18:29:00
问题 I'm upgrading to sitecore 6.6 rev 120918 I'm using lucene 2.9.4.1 When going to the console index manager > choosing an index and then browse documents I get the error: Could not load file or assembly 'Lucene.Net, Version=2.3.1.3, Culture=neutral, PublicKeyToken=null' or one of its dependencies. My understanding is that is a deprecated version, any insights on how can I solve this? 回答1: I presume you used the Index Viewer from Sitecore Marketplace? You need to make sure you are running the

Lucene .NET result subsets

 ̄綄美尐妖づ 提交于 2019-12-12 17:14:23
问题 I am using Lucene .NET Let's say I want to only return 50 results starting at result 100, how might I go about that? I've searched the docs but am not finding anything. Is there something I'm missing? 回答1: I assume you are doing this for the purpose of paging. The way this is normally done in a Lucene implementation (including Solr) is by simply executing the query normally, but only actually loading the stored data for the results you are interested in. In a typical paging scenario, this may

how do i filter my lucene search results?

邮差的信 提交于 2019-12-12 16:08:55
问题 Say my requirement is "search for all users by name, who are over 18" If i were using SQL, i might write something like: Select * from [Users] Where ([firstname] like '%' + @searchTerm + '%' OR [lastname] like '%' + @searchTerm + '%') AND [age] >= 18 However, im having difficulty translating this into lucene.net. This is what i have so far: var parser = new MultiFieldQueryParser({ "firstname", "lastname"}, new StandardAnalyser()); var luceneQuery = parser.Parse(searchterm) var query =