You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@lucenenet.apache.org by Monica Black <ml...@hotmail.com> on 2016/12/12 18:48:12 UTC

Lucene 4.8 IndexSearcher question

Hi, all.


So happy you've revived Lucene.NET--hoping to see some more current news soon.


I want to create a web service to access Lucene Index I've made--how many concurrent IndexSearchers could I have over the same index?  Do you anticipate any issues with this approach?


Thanks!
Monica

RE: Lucene 4.8 IndexSearcher question

Posted by Shad Storhaug <sh...@shadstorhaug.com>.
Team,

I have submitted a pull request (https://github.com/apache/lucenenet/pull/207) with an alternative approach to the prior SearcherManager.ExecuteSearch() method (AcquireContext()) and would appreciate some feedback as to which approach is preferred, possible better naming or better approaches, etc. There is a quick example of each approach on the pull request.

There already is an API that came with Lucene, but it requires you to remember to use a try-finally block. 

var searcher = searchManger.Acquire()
try
{
    // Do your logic here...
}
finally
{
     searchManager.Release(searcher);
}

The primary purpose of this new API will be to make SearcherManager easier to use in .NET.

Thanks,
Shad Storhaug (NightOwl888)

-----Original Message-----
From: Shad Storhaug 
Sent: Tuesday, May 16, 2017 4:53 PM
To: user@lucenenet.apache.org
Subject: RE: Lucene 4.8 IndexSearcher question

Itamar,

I didn't notice it was missing until I tried to convert your demo.

I finally have a fix to the index corruption issue, so I will work on a release with that first. Afterward, I will submit the extension method I made as a pull request so you and the rest of the team can help me finalize it and/or decide to revert to the ExecuteSearch() method instead.

Thanks,
Shad Storhaug (NightOwl888)


-----Original Message-----
From: itamar.synhershko@gmail.com [mailto:itamar.synhershko@gmail.com] On Behalf Of Itamar Syn-Hershko
Sent: Tuesday, May 16, 2017 4:16 PM
To: user@lucenenet.apache.org
Subject: Re: Lucene 4.8 IndexSearcher question

Shad, I didn't notice you removed it :) can we get it back there before we graduate from beta?

--

Itamar Syn-Hershko
Freelance Developer & Consultant
Elasticsearch Partner
Microsoft MVP | Lucene.NET PMC
http://code972.com | @synhershko <https://twitter.com/synhershko> http://BigDataBoutique.co.il/

On Tue, May 16, 2017 at 4:55 AM, Shad Storhaug <sh...@shadstorhaug.com>
wrote:

> Matt,
>
> > Did your SearcherManager.ExecuteSearch() get removed from the releases?
>
> As this API was not appropriately marked as LUCENENET specific, it has 
> inadvertently been removed because it did not exist in the original source.
> But after analysis of the API, this pattern lends itself better to a 
> using block rather than using delegate methods. I have been 
> experimenting with adding such an API as an extension method to the 
> ReferenceManager<T>, so it would apply not just to the SearchManager, 
> but also to its other subclasses as well.
>
> In the meantime, you should use the original Lucene API, which is 
> intended to be used in a try-finally block:
>
> var searcher = searchManger.Acquire()
> try
> {
>     // Do your logic here...
> }
> finally
> {
>     searchManager.Release(searcher);
> }
>
> Here is an example: https://github.com/NightOwl888/LuceneNetDemo/
> blob/master/LuceneNetDemo/GitHubIndex.cs#L157-L183
>
> > One other thing I noticed is that the Lucene.Net.Index.Term used to 
> > be
> reusable. Even the comments state that it should be reusable (even in 
> Java 5.4<https://lucene.apache.org/core/5_4_0/core/org/apache/
> lucene/index/Term.html>).
> > Yet I don't see a way to reuse it and change the 'text' portion, 
> > given
> the current fields/methods.
>
> Be sure you are looking at the documentation for the correct Lucene
> version: https://lucene.apache.org/core/4_8_0/core/org/apache/
> lucene/index/Term.html. In 4.8, the Term was copied directly. It 
> wasn't made reusable until 5.4. Of course, it is simple enough to make 
> a reusable
> term:
>
> BytesRef bytes = new BytesRef("foo");
> var term = new Term(BytesRef.DeepCopyOf(bytes));
>
> Thanks,
> Shad Storhaug (NightOwl888)
>
>
> -----Original Message-----
> From: Matt Diehl [mailto:mdiehl@lexprompt.com.INVALID]
> Sent: Tuesday, May 16, 2017 6:31 AM
> To: user@lucenenet.apache.org
> Subject: Re: Lucene 4.8 IndexSearcher question
>
> Hi Itamar,
>
> Did your SearcherManager.ExecuteSearch() get removed from the 
> releases? I your example uses the code, but I don't see this in the release:
> https://www.myget.org/feed/lucene-net-ci/package/nuget/Lucene.Net  - 
> Lucene.Net.4.8.0-ci0000001084\lib\net451\Lucene.Net.dll
>
> Here's the original commit:
> https://www.mail-archive.com/commits@lucenenet.apache.org/msg01225.htm
> l
>
> One other thing I noticed is that the Lucene.Net.Index.Term used to be 
> reusable. Even the comments state that it should be reusable (even in 
> Java
> 5.4
> <https://lucene.apache.org/core/5_4_0/core/org/apache/
> lucene/index/Term.html>).
> Yet I don't see a way to reuse it and change the 'text' portion, given 
> the current fields/methods.
>
> Thanks, Matt
>
> On Mon, Dec 12, 2016 at 12:24 PM, Itamar Syn-Hershko 
> <it...@code972.com>
> wrote:
>
> > You can have several, but better to use the new SearcherManager to 
> > manage that for you. See the sample here:
> > https://github.com/synhershko/LuceneNetDemo
> >
> > --
> >
> > Itamar Syn-Hershko
> > http://code972.com | @synhershko <https://twitter.com/synhershko> 
> > Freelance Developer & Consultant Lucene.NET committer and PMC member
> >
> > On Mon, Dec 12, 2016 at 8:48 PM, Monica Black <ml...@hotmail.com>
> > wrote:
> >
> > > Hi, all.
> > >
> > >
> > > So happy you've revived Lucene.NET--hoping to see some more 
> > > current news soon.
> > >
> > >
> > > I want to create a web service to access Lucene Index I've 
> > > made--how many concurrent IndexSearchers could I have over the 
> > > same index?  Do you anticipate any issues with this approach?
> > >
> > >
> > > Thanks!
> > > Monica
> > >
> >
>

RE: Lucene 4.8 IndexSearcher question

Posted by Shad Storhaug <sh...@shadstorhaug.com>.
Itamar,

I didn't notice it was missing until I tried to convert your demo.

I finally have a fix to the index corruption issue, so I will work on a release with that first. Afterward, I will submit the extension method I made as a pull request so you and the rest of the team can help me finalize it and/or decide to revert to the ExecuteSearch() method instead.

Thanks,
Shad Storhaug (NightOwl888)


-----Original Message-----
From: itamar.synhershko@gmail.com [mailto:itamar.synhershko@gmail.com] On Behalf Of Itamar Syn-Hershko
Sent: Tuesday, May 16, 2017 4:16 PM
To: user@lucenenet.apache.org
Subject: Re: Lucene 4.8 IndexSearcher question

Shad, I didn't notice you removed it :) can we get it back there before we graduate from beta?

--

Itamar Syn-Hershko
Freelance Developer & Consultant
Elasticsearch Partner
Microsoft MVP | Lucene.NET PMC
http://code972.com | @synhershko <https://twitter.com/synhershko> http://BigDataBoutique.co.il/

On Tue, May 16, 2017 at 4:55 AM, Shad Storhaug <sh...@shadstorhaug.com>
wrote:

> Matt,
>
> > Did your SearcherManager.ExecuteSearch() get removed from the releases?
>
> As this API was not appropriately marked as LUCENENET specific, it has 
> inadvertently been removed because it did not exist in the original source.
> But after analysis of the API, this pattern lends itself better to a 
> using block rather than using delegate methods. I have been 
> experimenting with adding such an API as an extension method to the 
> ReferenceManager<T>, so it would apply not just to the SearchManager, 
> but also to its other subclasses as well.
>
> In the meantime, you should use the original Lucene API, which is 
> intended to be used in a try-finally block:
>
> var searcher = searchManger.Acquire()
> try
> {
>     // Do your logic here...
> }
> finally
> {
>     searchManager.Release(searcher);
> }
>
> Here is an example: https://github.com/NightOwl888/LuceneNetDemo/
> blob/master/LuceneNetDemo/GitHubIndex.cs#L157-L183
>
> > One other thing I noticed is that the Lucene.Net.Index.Term used to 
> > be
> reusable. Even the comments state that it should be reusable (even in 
> Java 5.4<https://lucene.apache.org/core/5_4_0/core/org/apache/
> lucene/index/Term.html>).
> > Yet I don't see a way to reuse it and change the 'text' portion, 
> > given
> the current fields/methods.
>
> Be sure you are looking at the documentation for the correct Lucene
> version: https://lucene.apache.org/core/4_8_0/core/org/apache/
> lucene/index/Term.html. In 4.8, the Term was copied directly. It 
> wasn't made reusable until 5.4. Of course, it is simple enough to make 
> a reusable
> term:
>
> BytesRef bytes = new BytesRef("foo");
> var term = new Term(BytesRef.DeepCopyOf(bytes));
>
> Thanks,
> Shad Storhaug (NightOwl888)
>
>
> -----Original Message-----
> From: Matt Diehl [mailto:mdiehl@lexprompt.com.INVALID]
> Sent: Tuesday, May 16, 2017 6:31 AM
> To: user@lucenenet.apache.org
> Subject: Re: Lucene 4.8 IndexSearcher question
>
> Hi Itamar,
>
> Did your SearcherManager.ExecuteSearch() get removed from the 
> releases? I your example uses the code, but I don't see this in the release:
> https://www.myget.org/feed/lucene-net-ci/package/nuget/Lucene.Net  - 
> Lucene.Net.4.8.0-ci0000001084\lib\net451\Lucene.Net.dll
>
> Here's the original commit:
> https://www.mail-archive.com/commits@lucenenet.apache.org/msg01225.htm
> l
>
> One other thing I noticed is that the Lucene.Net.Index.Term used to be 
> reusable. Even the comments state that it should be reusable (even in 
> Java
> 5.4
> <https://lucene.apache.org/core/5_4_0/core/org/apache/
> lucene/index/Term.html>).
> Yet I don't see a way to reuse it and change the 'text' portion, given 
> the current fields/methods.
>
> Thanks, Matt
>
> On Mon, Dec 12, 2016 at 12:24 PM, Itamar Syn-Hershko 
> <it...@code972.com>
> wrote:
>
> > You can have several, but better to use the new SearcherManager to 
> > manage that for you. See the sample here:
> > https://github.com/synhershko/LuceneNetDemo
> >
> > --
> >
> > Itamar Syn-Hershko
> > http://code972.com | @synhershko <https://twitter.com/synhershko> 
> > Freelance Developer & Consultant Lucene.NET committer and PMC member
> >
> > On Mon, Dec 12, 2016 at 8:48 PM, Monica Black <ml...@hotmail.com>
> > wrote:
> >
> > > Hi, all.
> > >
> > >
> > > So happy you've revived Lucene.NET--hoping to see some more 
> > > current news soon.
> > >
> > >
> > > I want to create a web service to access Lucene Index I've 
> > > made--how many concurrent IndexSearchers could I have over the 
> > > same index?  Do you anticipate any issues with this approach?
> > >
> > >
> > > Thanks!
> > > Monica
> > >
> >
>

Re: Lucene 4.8 IndexSearcher question

Posted by Itamar Syn-Hershko <it...@code972.com>.
Shad, I didn't notice you removed it :) can we get it back there before we
graduate from beta?

--

Itamar Syn-Hershko
Freelance Developer & Consultant
Elasticsearch Partner
Microsoft MVP | Lucene.NET PMC
http://code972.com | @synhershko <https://twitter.com/synhershko>
http://BigDataBoutique.co.il/

On Tue, May 16, 2017 at 4:55 AM, Shad Storhaug <sh...@shadstorhaug.com>
wrote:

> Matt,
>
> > Did your SearcherManager.ExecuteSearch() get removed from the releases?
>
> As this API was not appropriately marked as LUCENENET specific, it has
> inadvertently been removed because it did not exist in the original source.
> But after analysis of the API, this pattern lends itself better to a using
> block rather than using delegate methods. I have been experimenting with
> adding such an API as an extension method to the ReferenceManager<T>, so it
> would apply not just to the SearchManager, but also to its other subclasses
> as well.
>
> In the meantime, you should use the original Lucene API, which is intended
> to be used in a try-finally block:
>
> var searcher = searchManger.Acquire()
> try
> {
>     // Do your logic here...
> }
> finally
> {
>     searchManager.Release(searcher);
> }
>
> Here is an example: https://github.com/NightOwl888/LuceneNetDemo/
> blob/master/LuceneNetDemo/GitHubIndex.cs#L157-L183
>
> > One other thing I noticed is that the Lucene.Net.Index.Term used to be
> reusable. Even the comments state that it should be reusable (even in Java
> 5.4<https://lucene.apache.org/core/5_4_0/core/org/apache/
> lucene/index/Term.html>).
> > Yet I don't see a way to reuse it and change the 'text' portion, given
> the current fields/methods.
>
> Be sure you are looking at the documentation for the correct Lucene
> version: https://lucene.apache.org/core/4_8_0/core/org/apache/
> lucene/index/Term.html. In 4.8, the Term was copied directly. It wasn't
> made reusable until 5.4. Of course, it is simple enough to make a reusable
> term:
>
> BytesRef bytes = new BytesRef("foo");
> var term = new Term(BytesRef.DeepCopyOf(bytes));
>
> Thanks,
> Shad Storhaug (NightOwl888)
>
>
> -----Original Message-----
> From: Matt Diehl [mailto:mdiehl@lexprompt.com.INVALID]
> Sent: Tuesday, May 16, 2017 6:31 AM
> To: user@lucenenet.apache.org
> Subject: Re: Lucene 4.8 IndexSearcher question
>
> Hi Itamar,
>
> Did your SearcherManager.ExecuteSearch() get removed from the releases? I
> your example uses the code, but I don't see this in the release:
> https://www.myget.org/feed/lucene-net-ci/package/nuget/Lucene.Net  -
> Lucene.Net.4.8.0-ci0000001084\lib\net451\Lucene.Net.dll
>
> Here's the original commit:
> https://www.mail-archive.com/commits@lucenenet.apache.org/msg01225.html
>
> One other thing I noticed is that the Lucene.Net.Index.Term used to be
> reusable. Even the comments state that it should be reusable (even in Java
> 5.4
> <https://lucene.apache.org/core/5_4_0/core/org/apache/
> lucene/index/Term.html>).
> Yet I don't see a way to reuse it and change the 'text' portion, given the
> current fields/methods.
>
> Thanks, Matt
>
> On Mon, Dec 12, 2016 at 12:24 PM, Itamar Syn-Hershko <it...@code972.com>
> wrote:
>
> > You can have several, but better to use the new SearcherManager to
> > manage that for you. See the sample here:
> > https://github.com/synhershko/LuceneNetDemo
> >
> > --
> >
> > Itamar Syn-Hershko
> > http://code972.com | @synhershko <https://twitter.com/synhershko>
> > Freelance Developer & Consultant Lucene.NET committer and PMC member
> >
> > On Mon, Dec 12, 2016 at 8:48 PM, Monica Black <ml...@hotmail.com>
> > wrote:
> >
> > > Hi, all.
> > >
> > >
> > > So happy you've revived Lucene.NET--hoping to see some more current
> > > news soon.
> > >
> > >
> > > I want to create a web service to access Lucene Index I've made--how
> > > many concurrent IndexSearchers could I have over the same index?  Do
> > > you anticipate any issues with this approach?
> > >
> > >
> > > Thanks!
> > > Monica
> > >
> >
>

RE: Lucene 4.8 IndexSearcher question

Posted by Matt Diehl <ma...@gooddiehl.net.INVALID>.
Great thanks Shad!

On May 15, 2017 7:55 PM, "Shad Storhaug" <sh...@shadstorhaug.com> wrote:

Matt,

> Did your SearcherManager.ExecuteSearch() get removed from the releases?

As this API was not appropriately marked as LUCENENET specific, it has
inadvertently been removed because it did not exist in the original source.
But after analysis of the API, this pattern lends itself better to a using
block rather than using delegate methods. I have been experimenting with
adding such an API as an extension method to the ReferenceManager<T>, so it
would apply not just to the SearchManager, but also to its other subclasses
as well.

In the meantime, you should use the original Lucene API, which is intended
to be used in a try-finally block:

var searcher = searchManger.Acquire()
try
{
    // Do your logic here...
}
finally
{
    searchManager.Release(searcher);
}

Here is an example: https://github.com/NightOwl888/LuceneNetDemo/
blob/master/LuceneNetDemo/GitHubIndex.cs#L157-L183

> One other thing I noticed is that the Lucene.Net.Index.Term used to be
reusable. Even the comments state that it should be reusable (even in Java
5.4<https://lucene.apache.org/core/5_4_0/core/org/apache/
lucene/index/Term.html>).
> Yet I don't see a way to reuse it and change the 'text' portion, given
the current fields/methods.

Be sure you are looking at the documentation for the correct Lucene
version: https://lucene.apache.org/core/4_8_0/core/org/apache/
lucene/index/Term.html. In 4.8, the Term was copied directly. It wasn't
made reusable until 5.4. Of course, it is simple enough to make a reusable
term:

BytesRef bytes = new BytesRef("foo");
var term = new Term(BytesRef.DeepCopyOf(bytes));

Thanks,
Shad Storhaug (NightOwl888)


-----Original Message-----
From: Matt Diehl [mailto:mdiehl@lexprompt.com.INVALID]
Sent: Tuesday, May 16, 2017 6:31 AM
To: user@lucenenet.apache.org
Subject: Re: Lucene 4.8 IndexSearcher question

Hi Itamar,

Did your SearcherManager.ExecuteSearch() get removed from the releases? I
your example uses the code, but I don't see this in the release:
https://www.myget.org/feed/lucene-net-ci/package/nuget/Lucene.Net  -
Lucene.Net.4.8.0-ci0000001084\lib\net451\Lucene.Net.dll

Here's the original commit:
https://www.mail-archive.com/commits@lucenenet.apache.org/msg01225.html

One other thing I noticed is that the Lucene.Net.Index.Term used to be
reusable. Even the comments state that it should be reusable (even in Java
5.4
<https://lucene.apache.org/core/5_4_0/core/org/apache/lucene/index/Term.html
>).
Yet I don't see a way to reuse it and change the 'text' portion, given the
current fields/methods.

Thanks, Matt

On Mon, Dec 12, 2016 at 12:24 PM, Itamar Syn-Hershko <it...@code972.com>
wrote:

> You can have several, but better to use the new SearcherManager to
> manage that for you. See the sample here:
> https://github.com/synhershko/LuceneNetDemo
>
> --
>
> Itamar Syn-Hershko
> http://code972.com | @synhershko <https://twitter.com/synhershko>
> Freelance Developer & Consultant Lucene.NET committer and PMC member
>
> On Mon, Dec 12, 2016 at 8:48 PM, Monica Black <ml...@hotmail.com>
> wrote:
>
> > Hi, all.
> >
> >
> > So happy you've revived Lucene.NET--hoping to see some more current
> > news soon.
> >
> >
> > I want to create a web service to access Lucene Index I've made--how
> > many concurrent IndexSearchers could I have over the same index?  Do
> > you anticipate any issues with this approach?
> >
> >
> > Thanks!
> > Monica
> >
>

RE: Lucene 4.8 IndexSearcher question

Posted by Shad Storhaug <sh...@shadstorhaug.com>.
Here is an example: https://github.com/NightOwl888/LuceneNetDemo/blob/master/LuceneNetDemo/GitHubIndex.cs#L157-L183

>> One other thing I noticed is that the Lucene.Net.Index.Term used to be reusable. Even the comments state that it should be reusable (even in Java 5.4<https://lucene.apache.org/core/5_4_0/core/org/apache/lucene/index/Term.html>).
>> Yet I don't see a way to reuse it and change the 'text' portion, given the current fields/methods.

>Be sure you are looking at the documentation for the correct Lucene version: https://lucene.apache.org/core/4_8_0/core/org/apache/lucene/index/Term.html. In 4.8, the Term was copied directly. It wasn't made reusable until 5.4. Of course, it is simple enough to make a reusable term:

> BytesRef bytes = new BytesRef("foo");
> var term = new Term(BytesRef.DeepCopyOf(bytes));

Oops, that should have been:

BytesRef bytes = new BytesRef("foo");
var term = new Term("fieldName", BytesRef.DeepCopyOf(bytes));


-----Original Message-----
From: Shad Storhaug [mailto:shad@shadstorhaug.com] 
Sent: Tuesday, May 16, 2017 8:55 AM
To: user@lucenenet.apache.org
Subject: RE: Lucene 4.8 IndexSearcher question

Matt,

> Did your SearcherManager.ExecuteSearch() get removed from the releases?

As this API was not appropriately marked as LUCENENET specific, it has inadvertently been removed because it did not exist in the original source. But after analysis of the API, this pattern lends itself better to a using block rather than using delegate methods. I have been experimenting with adding such an API as an extension method to the ReferenceManager<T>, so it would apply not just to the SearchManager, but also to its other subclasses as well.

In the meantime, you should use the original Lucene API, which is intended to be used in a try-finally block:

var searcher = searchManger.Acquire()
try
{
    // Do your logic here...
}
finally
{
    searchManager.Release(searcher);
}

Here is an example: https://github.com/NightOwl888/LuceneNetDemo/blob/master/LuceneNetDemo/GitHubIndex.cs#L157-L183

> One other thing I noticed is that the Lucene.Net.Index.Term used to be reusable. Even the comments state that it should be reusable (even in Java 5.4<https://lucene.apache.org/core/5_4_0/core/org/apache/lucene/index/Term.html>).
> Yet I don't see a way to reuse it and change the 'text' portion, given the current fields/methods.

Be sure you are looking at the documentation for the correct Lucene version: https://lucene.apache.org/core/4_8_0/core/org/apache/lucene/index/Term.html. In 4.8, the Term was copied directly. It wasn't made reusable until 5.4. Of course, it is simple enough to make a reusable term:

BytesRef bytes = new BytesRef("foo");
var term = new Term(BytesRef.DeepCopyOf(bytes));

Thanks,
Shad Storhaug (NightOwl888)


-----Original Message-----
From: Matt Diehl [mailto:mdiehl@lexprompt.com.INVALID]
Sent: Tuesday, May 16, 2017 6:31 AM
To: user@lucenenet.apache.org
Subject: Re: Lucene 4.8 IndexSearcher question

Hi Itamar,

Did your SearcherManager.ExecuteSearch() get removed from the releases? I your example uses the code, but I don't see this in the release:
https://www.myget.org/feed/lucene-net-ci/package/nuget/Lucene.Net  - Lucene.Net.4.8.0-ci0000001084\lib\net451\Lucene.Net.dll

Here's the original commit:
https://www.mail-archive.com/commits@lucenenet.apache.org/msg01225.html

One other thing I noticed is that the Lucene.Net.Index.Term used to be reusable. Even the comments state that it should be reusable (even in Java
5.4
<https://lucene.apache.org/core/5_4_0/core/org/apache/lucene/index/Term.html>).
Yet I don't see a way to reuse it and change the 'text' portion, given the current fields/methods.

Thanks, Matt

On Mon, Dec 12, 2016 at 12:24 PM, Itamar Syn-Hershko <it...@code972.com>
wrote:

> You can have several, but better to use the new SearcherManager to 
> manage that for you. See the sample here:
> https://github.com/synhershko/LuceneNetDemo
>
> --
>
> Itamar Syn-Hershko
> http://code972.com | @synhershko <https://twitter.com/synhershko> 
> Freelance Developer & Consultant Lucene.NET committer and PMC member
>
> On Mon, Dec 12, 2016 at 8:48 PM, Monica Black <ml...@hotmail.com>
> wrote:
>
> > Hi, all.
> >
> >
> > So happy you've revived Lucene.NET--hoping to see some more current 
> > news soon.
> >
> >
> > I want to create a web service to access Lucene Index I've made--how 
> > many concurrent IndexSearchers could I have over the same index?  Do 
> > you anticipate any issues with this approach?
> >
> >
> > Thanks!
> > Monica
> >
>

RE: Lucene 4.8 IndexSearcher question

Posted by Shad Storhaug <sh...@shadstorhaug.com>.
Matt,

> Did your SearcherManager.ExecuteSearch() get removed from the releases?

As this API was not appropriately marked as LUCENENET specific, it has inadvertently been removed because it did not exist in the original source. But after analysis of the API, this pattern lends itself better to a using block rather than using delegate methods. I have been experimenting with adding such an API as an extension method to the ReferenceManager<T>, so it would apply not just to the SearchManager, but also to its other subclasses as well.

In the meantime, you should use the original Lucene API, which is intended to be used in a try-finally block:

var searcher = searchManger.Acquire()
try
{
    // Do your logic here...
}
finally
{
    searchManager.Release(searcher);
}

Here is an example: https://github.com/NightOwl888/LuceneNetDemo/blob/master/LuceneNetDemo/GitHubIndex.cs#L157-L183

> One other thing I noticed is that the Lucene.Net.Index.Term used to be reusable. Even the comments state that it should be reusable (even in Java 5.4<https://lucene.apache.org/core/5_4_0/core/org/apache/lucene/index/Term.html>).
> Yet I don't see a way to reuse it and change the 'text' portion, given the current fields/methods.

Be sure you are looking at the documentation for the correct Lucene version: https://lucene.apache.org/core/4_8_0/core/org/apache/lucene/index/Term.html. In 4.8, the Term was copied directly. It wasn't made reusable until 5.4. Of course, it is simple enough to make a reusable term:

BytesRef bytes = new BytesRef("foo");
var term = new Term(BytesRef.DeepCopyOf(bytes));

Thanks,
Shad Storhaug (NightOwl888)


-----Original Message-----
From: Matt Diehl [mailto:mdiehl@lexprompt.com.INVALID] 
Sent: Tuesday, May 16, 2017 6:31 AM
To: user@lucenenet.apache.org
Subject: Re: Lucene 4.8 IndexSearcher question

Hi Itamar,

Did your SearcherManager.ExecuteSearch() get removed from the releases? I your example uses the code, but I don't see this in the release:
https://www.myget.org/feed/lucene-net-ci/package/nuget/Lucene.Net  - Lucene.Net.4.8.0-ci0000001084\lib\net451\Lucene.Net.dll

Here's the original commit:
https://www.mail-archive.com/commits@lucenenet.apache.org/msg01225.html

One other thing I noticed is that the Lucene.Net.Index.Term used to be reusable. Even the comments state that it should be reusable (even in Java
5.4
<https://lucene.apache.org/core/5_4_0/core/org/apache/lucene/index/Term.html>).
Yet I don't see a way to reuse it and change the 'text' portion, given the current fields/methods.

Thanks, Matt

On Mon, Dec 12, 2016 at 12:24 PM, Itamar Syn-Hershko <it...@code972.com>
wrote:

> You can have several, but better to use the new SearcherManager to 
> manage that for you. See the sample here:
> https://github.com/synhershko/LuceneNetDemo
>
> --
>
> Itamar Syn-Hershko
> http://code972.com | @synhershko <https://twitter.com/synhershko> 
> Freelance Developer & Consultant Lucene.NET committer and PMC member
>
> On Mon, Dec 12, 2016 at 8:48 PM, Monica Black <ml...@hotmail.com>
> wrote:
>
> > Hi, all.
> >
> >
> > So happy you've revived Lucene.NET--hoping to see some more current 
> > news soon.
> >
> >
> > I want to create a web service to access Lucene Index I've made--how 
> > many concurrent IndexSearchers could I have over the same index?  Do 
> > you anticipate any issues with this approach?
> >
> >
> > Thanks!
> > Monica
> >
>

Re: Lucene 4.8 IndexSearcher question

Posted by Matt Diehl <md...@lexprompt.com.INVALID>.
Hi Itamar,

Did your SearcherManager.ExecuteSearch() get removed from the releases? I
your example uses the code, but I don't see this in the release:
https://www.myget.org/feed/lucene-net-ci/package/nuget/Lucene.Net  -
Lucene.Net.4.8.0-ci0000001084\lib\net451\Lucene.Net.dll

Here's the original commit:
https://www.mail-archive.com/commits@lucenenet.apache.org/msg01225.html

One other thing I noticed is that the Lucene.Net.Index.Term used to be
reusable. Even the comments state that it should be reusable (even in Java
5.4
<https://lucene.apache.org/core/5_4_0/core/org/apache/lucene/index/Term.html>).
Yet I don't see a way to reuse it and change the 'text' portion, given the
current fields/methods.

Thanks, Matt

On Mon, Dec 12, 2016 at 12:24 PM, Itamar Syn-Hershko <it...@code972.com>
wrote:

> You can have several, but better to use the new SearcherManager to manage
> that for you. See the sample here:
> https://github.com/synhershko/LuceneNetDemo
>
> --
>
> Itamar Syn-Hershko
> http://code972.com | @synhershko <https://twitter.com/synhershko>
> Freelance Developer & Consultant
> Lucene.NET committer and PMC member
>
> On Mon, Dec 12, 2016 at 8:48 PM, Monica Black <ml...@hotmail.com>
> wrote:
>
> > Hi, all.
> >
> >
> > So happy you've revived Lucene.NET--hoping to see some more current news
> > soon.
> >
> >
> > I want to create a web service to access Lucene Index I've made--how many
> > concurrent IndexSearchers could I have over the same index?  Do you
> > anticipate any issues with this approach?
> >
> >
> > Thanks!
> > Monica
> >
>

Re: Lucene 4.8 IndexSearcher question

Posted by Itamar Syn-Hershko <it...@code972.com>.
You can have several, but better to use the new SearcherManager to manage
that for you. See the sample here:
https://github.com/synhershko/LuceneNetDemo

--

Itamar Syn-Hershko
http://code972.com | @synhershko <https://twitter.com/synhershko>
Freelance Developer & Consultant
Lucene.NET committer and PMC member

On Mon, Dec 12, 2016 at 8:48 PM, Monica Black <ml...@hotmail.com> wrote:

> Hi, all.
>
>
> So happy you've revived Lucene.NET--hoping to see some more current news
> soon.
>
>
> I want to create a web service to access Lucene Index I've made--how many
> concurrent IndexSearchers could I have over the same index?  Do you
> anticipate any issues with this approach?
>
>
> Thanks!
> Monica
>