मुझे नहीं पता कि रजिस्ट्रेशन_DATE को इंडेक्स और खोज कैसे करें (इसमें एसक्यूएल प्रारूप डेटाटाइम है)। मुझे वर्षों या दिनों के बीच खोज करने की आवश्यकता है। जहां मैं खोज के लिए बूलियन क्वेरी का उपयोग कर रहा हूं। नीचे दिया गया कोड संख्यात्मक क्षेत्र के लिए उपयोग किया जाता है और सामान्य क्षेत्र अनुक्रमण।Lucene.NET में डेटाटाइम फ़ील्ड को इंडेक्स और खोज कैसे करें?
IndexWriter indexWriter = new IndexWriter(dir, new StandardAnalyzer(),Lucene.Net.Index.IndexWriter.MaxFieldLength.UNLIMITED);
DataSet ds = new DataSet();
//ds contains table
if (ds.Tables[0] != null)
{
DataTable dt = ds.Tables[0];
if (dt.Rows.Count > 0)
{
foreach (DataRow dr in dt.Rows)
{
//Create the Document object
Document doc = new Document();
foreach (DataColumn dc in dt.Columns)
{
string check = dc.ToString();
if (check.Equals("Experience"))
{
int n=Convert.ToInt32(dr[dc.ColumnName]);
NumericField numericField = new NumericField(dc.ColumnName, Field.Store.YES, true);
numericField.SetIntValue(n);
doc.Add(numericField);
}
else if(check.Equals("Registred_Date"))
{
}
else
{
doc.Add(new Field(dc.ColumnName, dr[dc.ColumnName].ToString(), Field.Store.YES, Field.Index.ANALYZED));
}
//Populate the document with the column name and value from our query
}
// Write the Document to the catalog
indexWriter.AddDocument(doc);
}
}
}
// Close the writer
indexWriter.Close();
जांच इस [Lucene.Net: मैं अपने खोज परिणामों के लिए एक तिथि फिल्टर जोड़ सकते हैं?] (Http: // stackoverflow .com/प्रश्न/4565303/लुसीन-नेट-कैसे-कर-मैं-ऐड-ए-डेट-फ़िल्टर-टू-माय-सर्च-नतीजे? answertab = वोट # टैब-टॉप) –