You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@lucenenet.apache.org by nima dilmaghani <ni...@gmail.com> on 2009/12/25 20:05:16 UTC
byteBuf in NIOFSDirectory.cs is never set
Hello,
I am new here so a please help me understand what is going on.
1. I see that the release version is over 2 1/2 years old but there has been
significant dev effort. So for a release product, is the 2 1/2 year old
version really what is recommended? If someone is to check out code from
svn repository to use, is there a build that would be production quality and
not too bleeding edge?
2. I went with the recommendation from George here:
http://mail-archives.apache.org/mod_mbox/incubator-lucene-net-user/200912.mbox/browser
and
tried to use the latest code.
When making this call:
indexWriter = new IndexWriter( niopfsDir, a, true,
IndexWriter.MaxFieldLength.UNLIMITED);
with the latest build (893876)
I get a null reference exception because in NIOFSDirectory.cs byteBuf's
initialization is commented out.
Thanks and Happy Holidays!
Nima
RE: No Stopwords
Posted by Digy <di...@gmail.com>.
I don't think that there will be a measurable performance difference in
using HashTable or string[].
Just to remind, StandardAnalyzer constructors that accept string[] for
stopwords are deprecated and will be removed with 3.0.
DIGY
-----Original Message-----
From: T. R. Halvorson [mailto:trh@midrivers.com]
Sent: Friday, December 25, 2009 11:36 PM
To: lucene-net-user@lucene.apache.org
Subject: No Stopwords
To initialize the StandardAnalyzer to use no stop words, the following code
seems to work. I question, however, whether it is the best way to do it. Is
there a better way?
One wonders whether having a string array with one element whose value is
set to the empty string causes the analyzer to repeatedly check the array
and examine its one element. Besides the risk of a performance loss, the
approach in the code below seems like a kludge.
C#
------------------------
// about to initialize StandardAnalyzer to use no stopwords
// apparently Lucene uses a hash table with keys internally for stoplist
// need to prevent Key from being Null
//
// set object reference to string array of stopwords to an instance
string[] saStopWords = new string[0];
// keep Key from being Null
saStopWords(0) = string.Empty;
// instantiate StandardAnalyzer to use no stopwords
StandardAnalyzer lucAnalyzer = new StandardAnalyzer(saStopWords);
Visual Basic
------------------------
' about to initialize StandardAnalyzer to use no stopwords
' apparently Lucene uses a hash table with keys internally for stoplist
' need to prevent Key from being Null
'
' set object reference to string array of stopwords to an instance
Dim saStopWords(0) As String
' keep Key from being Null
saStopWords(0) = String.Empty
' instantiate StandardAnalyzer to use no stopwords
Dim lucAnalyzer As New StandardAnalyzer(saStopWords)
I figure that using the first overload with no parameter specifying
stopwords instantiates the analyzer to use the default stoplist for that
analyzer. If that's so, then that overload is out. It won't let me analyze
using no stopwords.
The overload whose single parameter is a string array works, but only if the
string array reference is set to an instance, hence:
string[] saStopWords = new string[0];
or
Dim saStopWords() as String
and only if Key is not Null, hence:
saStopWords(0) = string.Empty;
or
saStopWords(0) = String.Empty
So there ya go, with the analyzer probably repeatedly examining the array
and its single element.
I wonder whether the overload that takes a hashtable as a parameter can be
used in some way that prevents repeated, useless examination of the table.
Any ideas?
Thanks for any help.
T. R.
trh@midrivers.com
http://www.linkedin.com/in/trhalvorson
www.ncodian.com
http://twitter.com/trhalvorson
No Stopwords
Posted by "T. R. Halvorson" <tr...@midrivers.com>.
To initialize the StandardAnalyzer to use no stop words, the following code
seems to work. I question, however, whether it is the best way to do it. Is
there a better way?
One wonders whether having a string array with one element whose value is
set to the empty string causes the analyzer to repeatedly check the array
and examine its one element. Besides the risk of a performance loss, the
approach in the code below seems like a kludge.
C#
------------------------
// about to initialize StandardAnalyzer to use no stopwords
// apparently Lucene uses a hash table with keys internally for stoplist
// need to prevent Key from being Null
//
// set object reference to string array of stopwords to an instance
string[] saStopWords = new string[0];
// keep Key from being Null
saStopWords(0) = string.Empty;
// instantiate StandardAnalyzer to use no stopwords
StandardAnalyzer lucAnalyzer = new StandardAnalyzer(saStopWords);
Visual Basic
------------------------
' about to initialize StandardAnalyzer to use no stopwords
' apparently Lucene uses a hash table with keys internally for stoplist
' need to prevent Key from being Null
'
' set object reference to string array of stopwords to an instance
Dim saStopWords(0) As String
' keep Key from being Null
saStopWords(0) = String.Empty
' instantiate StandardAnalyzer to use no stopwords
Dim lucAnalyzer As New StandardAnalyzer(saStopWords)
I figure that using the first overload with no parameter specifying
stopwords instantiates the analyzer to use the default stoplist for that
analyzer. If that's so, then that overload is out. It won't let me analyze
using no stopwords.
The overload whose single parameter is a string array works, but only if the
string array reference is set to an instance, hence:
string[] saStopWords = new string[0];
or
Dim saStopWords() as String
and only if Key is not Null, hence:
saStopWords(0) = string.Empty;
or
saStopWords(0) = String.Empty
So there ya go, with the analyzer probably repeatedly examining the array
and its single element.
I wonder whether the overload that takes a hashtable as a parameter can be
used in some way that prevents repeated, useless examination of the table.
Any ideas?
Thanks for any help.
T. R.
trh@midrivers.com
http://www.linkedin.com/in/trhalvorson
www.ncodian.com
http://twitter.com/trhalvorson
RE: byteBuf in NIOFSDirectory.cs is never set
Posted by Michael Garski <mg...@myspace-inc.com>.
Nima,
The JavaDocs are the currently the most accurate documentation on
Lucene.Net
[http://lucene.apache.org/java/2_9_1/api/all/org/apache/lucene/store/FSD
irectory.html].
In 2.9, the static method FSDirectory.Open should be used, which will
create an instance of the appropriate FSDirectory type, which for
Lucene.Net will be SimpleFSDirectory.
Michael
-----Original Message-----
From: nima dilmaghani [mailto:nimadi@gmail.com]
Sent: Wednesday, January 06, 2010 5:48 AM
To: lucene-net-user@lucene.apache.org
Subject: Re: byteBuf in NIOFSDirectory.cs is never set
Thanks!
Is there a writeup somewhere describing the differences among the
Directory
classes? The documentation is copy and pasted from the Java version and
I
suspect the differences due to JVM peculiarities and such do not really
translate to the .NET world : ). So how do we chose between these?
Thanks!
Nima
On Fri, Dec 25, 2009 at 4:38 PM, Digy <di...@gmail.com> wrote:
> Hi Nima,
>
> Altought there isn't any official release during the past 2-3 years,
many
> Lucene.Net tags are created and these versions are used by many people
in
> production environments.
> See https://svn.apache.org/repos/asf/incubator/lucene.net/tags
>
> The latest version in trunk is 2.9.1 and is almost ready.
>
> "NIOFSDirectory" and "MmapDirectory" may be problematic(as you hit one
of
> them). If you avoid using them, I don't think that you will face with
a
> problem.
>
> DIGY
>
> -----Original Message-----
> From: nima dilmaghani [mailto:nimadi@gmail.com]
> Sent: Friday, December 25, 2009 9:05 PM
> To: lucene-net-user@lucene.apache.org
> Subject: byteBuf in NIOFSDirectory.cs is never set
>
> Hello,
>
> I am new here so a please help me understand what is going on.
>
> 1. I see that the release version is over 2 1/2 years old but there
has
> been
> significant dev effort. So for a release product, is the 2 1/2 year
old
> version really what is recommended? If someone is to check out code
from
> svn repository to use, is there a build that would be production
quality
> and
> not too bleeding edge?
>
> 2. I went with the recommendation from George here:
>
>
http://mail-archives.apache.org/mod_mbox/incubator-lucene-net-user/20091
2.mb
>
ox/browser<http://mail-archives.apache.org/mod_mbox/incubator-lucene-net
-user/200912.mbox/browser>
> and
> tried to use the latest code.
>
> When making this call:
>
> indexWriter = new IndexWriter( niopfsDir, a, true,
> IndexWriter.MaxFieldLength.UNLIMITED);
>
> with the latest build (893876)
>
> I get a null reference exception because in NIOFSDirectory.cs
byteBuf's
> initialization is commented out.
>
> Thanks and Happy Holidays!
>
> Nima
>
>
--
Nima
Re: byteBuf in NIOFSDirectory.cs is never set
Posted by nima dilmaghani <ni...@gmail.com>.
Thanks!
Is there a writeup somewhere describing the differences among the Directory
classes? The documentation is copy and pasted from the Java version and I
suspect the differences due to JVM peculiarities and such do not really
translate to the .NET world : ). So how do we chose between these?
Thanks!
Nima
On Fri, Dec 25, 2009 at 4:38 PM, Digy <di...@gmail.com> wrote:
> Hi Nima,
>
> Altought there isn't any official release during the past 2-3 years, many
> Lucene.Net tags are created and these versions are used by many people in
> production environments.
> See https://svn.apache.org/repos/asf/incubator/lucene.net/tags
>
> The latest version in trunk is 2.9.1 and is almost ready.
>
> "NIOFSDirectory" and "MmapDirectory" may be problematic(as you hit one of
> them). If you avoid using them, I don't think that you will face with a
> problem.
>
> DIGY
>
> -----Original Message-----
> From: nima dilmaghani [mailto:nimadi@gmail.com]
> Sent: Friday, December 25, 2009 9:05 PM
> To: lucene-net-user@lucene.apache.org
> Subject: byteBuf in NIOFSDirectory.cs is never set
>
> Hello,
>
> I am new here so a please help me understand what is going on.
>
> 1. I see that the release version is over 2 1/2 years old but there has
> been
> significant dev effort. So for a release product, is the 2 1/2 year old
> version really what is recommended? If someone is to check out code from
> svn repository to use, is there a build that would be production quality
> and
> not too bleeding edge?
>
> 2. I went with the recommendation from George here:
>
> http://mail-archives.apache.org/mod_mbox/incubator-lucene-net-user/200912.mb
> ox/browser<http://mail-archives.apache.org/mod_mbox/incubator-lucene-net-user/200912.mbox/browser>
> and
> tried to use the latest code.
>
> When making this call:
>
> indexWriter = new IndexWriter( niopfsDir, a, true,
> IndexWriter.MaxFieldLength.UNLIMITED);
>
> with the latest build (893876)
>
> I get a null reference exception because in NIOFSDirectory.cs byteBuf's
> initialization is commented out.
>
> Thanks and Happy Holidays!
>
> Nima
>
>
--
Nima
RE: byteBuf in NIOFSDirectory.cs is never set
Posted by Digy <di...@gmail.com>.
Hi Nima,
Altought there isn't any official release during the past 2-3 years, many
Lucene.Net tags are created and these versions are used by many people in
production environments.
See https://svn.apache.org/repos/asf/incubator/lucene.net/tags
The latest version in trunk is 2.9.1 and is almost ready.
"NIOFSDirectory" and "MmapDirectory" may be problematic(as you hit one of
them). If you avoid using them, I don't think that you will face with a
problem.
DIGY
-----Original Message-----
From: nima dilmaghani [mailto:nimadi@gmail.com]
Sent: Friday, December 25, 2009 9:05 PM
To: lucene-net-user@lucene.apache.org
Subject: byteBuf in NIOFSDirectory.cs is never set
Hello,
I am new here so a please help me understand what is going on.
1. I see that the release version is over 2 1/2 years old but there has been
significant dev effort. So for a release product, is the 2 1/2 year old
version really what is recommended? If someone is to check out code from
svn repository to use, is there a build that would be production quality and
not too bleeding edge?
2. I went with the recommendation from George here:
http://mail-archives.apache.org/mod_mbox/incubator-lucene-net-user/200912.mb
ox/browser
and
tried to use the latest code.
When making this call:
indexWriter = new IndexWriter( niopfsDir, a, true,
IndexWriter.MaxFieldLength.UNLIMITED);
with the latest build (893876)
I get a null reference exception because in NIOFSDirectory.cs byteBuf's
initialization is commented out.
Thanks and Happy Holidays!
Nima