lucene.net

Finding offsets of a search term in lucene.net,c#

∥☆過路亽.° 提交于 2019-12-23 02:47:11
问题 How could I get offsets for the tokens that has to be searched in Lucene.net?I am using FastVector Highlighter for highlighting a text? Note :I have already got the offsets of all the token that has been indexed using Standard Analyzer and now I would be interested in getting the offsets of the particular token? testhighlighter tst = new testhighlighter(); Lucene.Net.Analysis.Token net = tokenstream.Next(); int startoffset = net.StartOffset(); int endoffset = net.EndOffset(); 回答1: You can try

Using MultiFieldQueryParser

自古美人都是妖i 提交于 2019-12-23 02:40:38
问题 Am using MultiFieldQueryParser for parsing strings like a.a., b.b., etc But after parsing, its removing the dots in the string. What am i missing here? Thanks. 回答1: I'm not sure the MultiFieldQueryParser does what you think it does. Also...I'm not sure I know what you're trying to do. I do know that with any query parser, strings like 'a.a.' and 'b.b.' will have the periods stripped out because, at least with the default Analyzer, all punctuation is treated as white space. As far as the

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

一曲冷凌霜 提交于 2019-12-23 01:43:24
问题 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

Has anyone used lucene.net with Linq-to-Entities?

独自空忆成欢 提交于 2019-12-23 01:18:51
问题 If anyone has done this, please let me know. I don't know anything about lucene.net. I have never used it, but I heard about it. I was wondering how something like that would integrate with the Linq entity framework? 回答1: Check out Linq to Lucene project. 回答2: Check this article in linq to lucene discussion Linq to Lucene for Entity Framework working with entity framework only one class add 来源: https://stackoverflow.com/questions/153290/has-anyone-used-lucene-net-with-linq-to-entities

Lucene.NET - do an AND search multiple words on multiple fields

℡╲_俬逩灬. 提交于 2019-12-22 13:53:39
问题 I define a Document object for my product entity which has several fields: Title, Brand, Category, Size, Color, Material. Now I want to support user to do an AND search on multiple fields. Any document that have one, two or more fields contain all the search words will be responded. For example, when user enter "gucci shirt red" I want to return all documents that have fields matched with all 3 tokens "gucci", "shirt" AND "red". So all documents below will be responded: 1.Documents with title

Substring with spacebar search in RavenDB

倖福魔咒の 提交于 2019-12-22 10:54:01
问题 I'm using such a query: var query = "*" + QueryParser.Escape(input) + "*"; session.Query<User, UsersByEmailAndName>().Where(x => x.Email.In(query) || x.DisplayName.In(query)); With the support of a simple index: public UsersByEmailAndName() { Map = users => from user in users select new { user.Email, user.DisplayName, }; } Here I've read that: "By default, RavenDB uses a custom analyzer called LowerCaseKeywordAnalyzer for all content. (...) The default values for each field are FieldStorage

Lucene.net and partial “starts with” phrase search

醉酒当歌 提交于 2019-12-22 09:56:44
问题 I'm looking to build an auto-complete textbox over a large quantity of city names. Search functionality is as follows: I want a "Starts with" search over a multi-word phrase. For example, if user has typed in "chicago he", only locations such as "Chicago Heights" need to be returned. I'm trying to use Lucene for this. I'm having issues understanding how this needs to be implemented. I've tried what I think is the approach that should work: I've indexed locations with KeywordAnalyzer (I've

Lucene.net 2.9.2 sorting (sort doesn't work)

拜拜、爱过 提交于 2019-12-22 05:45:10
问题 I've got problem with sorting my lucene.net index in .NET. I tried almost every solution on stackoverflow and looking for google answers. I'm using Lucene.NET 2.9.2 and ASP.NET 2.0. I want to sort over string like in sql you can type 'order by Title desc [asc]' I will show you my code and I hope someone can help me. //Here I create Index with some fields doc.Add(new Field("prod_id",row["prod_id"].ToString(),Field.Store.YES,Field.Index.ANALYZED)); doc.Add(new Field("prod_title", row["prod

How to customize Lucene.NET to search for words with symbols without case-sensitivity (e.g. “C#” or “.net”)?

爷,独闯天下 提交于 2019-12-22 05:30:07
问题 The standard analyzer does not work. From what I can understand, it changes this to a search for c and net The WhitespaceAnalyzer would work but it's case sensitive. The general rule is search should work like Google so hoping it's a configuration thing considering .net , c# have been out there for a while or there's a workaround for this. Per the suggestions below, I tried the custom WhitespaceAnalyzer but then if the keywords are separated by a comma and no-space are not handled correctly e

Upgrading sitecore 6.6 index configuration to sitecore 7 (using ComputedFields)

笑着哭i 提交于 2019-12-22 05:11:56
问题 Sitecore CMS+DMS 6.6.0 rev.130404 => 7.0 rev.130424 In our project we have been using AdvancedDatabaseCrawler (ADC) for our indexes (specially because of it's dynamic fields feature). Here's a sample index configuration: <index id="GeoIndex" type="Sitecore.Search.Index, Sitecore.Kernel"> <param desc="name">$(id)</param> <param desc="folder">$(id)</param> <analyzer ref="search/analyzer" /> <locations hint="list:AddCrawler"> <web type="scSearchContrib.Crawler.Crawlers.AdvancedDatabaseCrawler,