lucene.net

Can I store a Lucene index in a database or other location than a file system?

血红的双手。 提交于 2019-12-06 08:40:51
I use Lucene.NET for my web project. I wish to migrate the indexing to webjobs using Azure, however Lucene uses an traditional 'file system' to store the index. Are there other options to stored and write to the index, such as SQL? Azure Directory for Lucene.Net: https://github.com/azure-contrib/AzureDirectory A bit, and probably not well supported, but there is no another option that I am aware of. You cannot store Lucene data in DB (whatever DB). It just makes no sense. All I/O operations in Lucene is done through the Directory class. So if want to use a different storage engine for your

Lucene Indexes in Sitecore getting corrupted (ArgumentOutOfRangeException)

谁都会走 提交于 2019-12-06 00:01:14
We are having an issue with searching a Lucene Index in Sitecore. Everything works fine for a while, and then, after what appears to be a random amount of time, we start getting the following error on every single search against the index: System.ArgumentOutOfRangeException Message: Non-negative number required. Parameter name: capacity Source: mscorlib at System.Collections.Hashtable..ctor(Int32 capacity, Single loadFactor) at System.Collections.Hashtable.Clone() at SupportClass.WeakHashTable.Clean() at SupportClass.WeakHashTable.CleanIfNeeded() at SupportClass.WeakHashTable.Add(Object key,

Maximum boost factor

不想你离开。 提交于 2019-12-05 23:48:11
What is the maxiimum boost factor value for a word in Lucene.Net? I believe default value is 1.0f Thanks! It can be any positive number. Of course, if you pick an unreasonable number, like Float.POSITIVE_INFINITY (or the .NET equivalent), you'll end up with some crazy scores. Generally, you want to look at your boosts as a percentage: 1.0F is 100%, meaning no boost up or down. 1.2F is 120%, a little boost up; 0.5 is 50%, a fairly significant boost down. I've found evidence on Google that it's at least 4... but I can't find any further information as to what the ceiling is. Some of the document

Lucene.net and partial “starts with” phrase search

旧街凉风 提交于 2019-12-05 23:30:39
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 tried both TOKENIZED and UN_TOKENIZED): doc.Add(new Field("Name", data.ToLower(), Field.Store.YES, Field

Lucene.net Fuzzy Phrase Search

跟風遠走 提交于 2019-12-05 22:29:10
I have tried this myself for a considerable period and looked everywhere around the net - but have been unable to find ANY examples of Fuzzy Phrase searching via Lucene.NET 2.9.2. ( C# ) Is something able to advise how to do this in detail and/or provide some example code - I would seriously seriously appreciate any help as I am totally stuck ? I assume that you have Lucene running and created a search index with some fields in it. So let's assume further that: var fields = ... // a string[] of the field names you wish to search in var version = Version.LUCENE_29; // your Lucene version var

How To Delete a Document using indexWriter in LuceneNet

好久不见. 提交于 2019-12-05 14:15:29
I have this method that I invoke in my controller that have to delete a specific Document. I read in some articles that the best way to delete a Document is using a IndexWriter. But I can't make it work. This is my code My Index: var article1 = new Document(); article1.Add(new Field("Id", "1", Field.Store.YES, Field.Index.ANALYZED)); article1.Add(new Field("Author", "Author", Field.Store.YES, Field.Index.ANALYZED)); article1.Add(new Field("Title", "Title", Field.Store.YES, Field.Index.ANALYZED)); var directory = FSDirectory.Open(new DirectoryInfo(IndexRoute)); var analyzar = new

How to store multiple distinct types of documents in Lucene

自作多情 提交于 2019-12-05 13:57:49
I have an existing Lucene store with many millions of documents, each one representing metadata for an entity. I have a few Id fields (Id1, Id2 .. Id5) and each document can have zero or many values for this field. The index is only ever queried by one of these Ids at a time. I've indexed these fields independently and it's is all working great. I initially chose to use Lucene as it was by far the fastest way to query such a vast number of small documents and I am happy with my decision. However now I must store another type of document which also represent a different kind of metadata for

Indexing multi-lingual content with Lucene.net

爱⌒轻易说出口 提交于 2019-12-05 13:14:00
I use Lucene.net for indexing content & documents etc.. on websites. The index is very simple and has this format: LuceneId - unique id for Lucene (TypeId + ItemId) TypeId - the type of text (eg. page content, product, public doc etc..) ItemId - the web page id, document id etc.. Text - the text indexed Title - web page title, document name etc.. to display with the search results I've got these options to adapt it to serve multi-lingual content: Create a separate index for each language. E.g. Lucene-enGB, Lucene-frFR etc.. Keep the one index and add an additional 'language' field to it to

Why is this Lucene query a “contains” instead of a “startsWith”?

落爺英雄遲暮 提交于 2019-12-05 10:43:36
string q = "m"; Query query = new QueryParser("company", new StandardAnalyzer()).Parse(q+"*"); will result in query being a prefixQuery :company:a* Still I will get results like "Fleet Africa" where it is rather obvious that the A is not at the start and thus gives me undesired results. Query query = new TermQuery(new Term("company", q+"*")); will result in query being a termQuery :company:a* and not returning any results. Probably because it interprets the query as an exact match and none of my values are the "a*" literal. Query query = new WildcardQuery(new Term("company", q+"*")); will

How to create more complex Lucene query strings?

我只是一个虾纸丫 提交于 2019-12-05 08:43:37
This question is a spin-off from this question. My inquiry is two-fold, but because both are related I think it is a good idea to put them together. How to programmatically create queries. I know I could start creating strings and get that string parsed with the query parser. But as I gather bits and pieces of information from other resources, there is a programattical way to do this. What are the syntax rules for the Lucene queries? --EDIT-- I'll give a requirement example for a query I would like to make: Say I have 5 fields: First Name Last Name Age Address Everything All fields are