SELECT Product.ID, Product.Decription, Product.Name FROM Product WHERE Product.Name LIKE '%Zelf%' OR Product.Decription LIKE '%Zelf%'īasically, Zelf is the input. SELECT Product.ID, Product.Decription, Product.Name FROM Product Return priceX > priceY ? 1 : priceX = priceY ? 0 : -1 Public int Compare(SearchProduct x, SearchProduct y) Return items / Amount + (items % Amount > 0 ? 1 : 0) Return copySearchProductList.OrderBy(n => n.Name).ToList() List copySearchProductList = new List(SearchProducts) ĬopySearchProductList = copySearchProductList.Skip((Page - 1) * Amount).Take(Amount).ToList() ĬopySearchProductList.Sort(new PriceSorter()) SearchLog.MakeEntry(queryString, SearchProducts.Count(), db, ) Page = page > maxPages ? maxPages : page Public LuceneSearchResultsVM(DB db, string queryString, List results, string searchOrderBy, int page, int amt)īTWActive = Settings.GetBool("BTWActive") īTWEXInput = Settings.GetBool("BTWEXInput") īTWExLeading = Settings.GetBool("BTWExLeading") Translator.Translate("pagina") + " " + Page + " " + Translator.Translate("van") + " " + SearchProducts.Count + " " + Translator.Translate("resultaten") + " - " + Return Translator.Translate("Zoekresultaten voor") + ": " + CurrentSearchString + " (" + MultiFieldQueryParser parser = new MultiFieldQueryParser(Version, TopScoreDocCollector collector = TopScoreDocCollector.Create(100, true) Searcher searcher = new IndexSearcher(reader) ![]() IndexReader reader = IndexReader.Open(GetCurrentDirectory(), true) ![]() SearchProduct product = SearchProduct.FromProduct(p, id) įield productIdField = new Field("productId", product.ID.ToString(),, ) įield productTitleField = new Field("productName", product.Name,, ) įield productDescriptionField = new Field("productDescription", product.Description,, ) įield productCategoryField = new Field("productCategory", product.Category,, ) įield productCategorySynonymField = new Field("productCategorySynonym", product.CategorySynonym,, ) įield productImageUrlField = new Field("productImageUrl", product.ImageUrl,, ) įield productTypeField = new Field("productType", product.Type,, ) įield productDescriptionShortField = new Field("productDescriptionShort", product.DescriptionShort,, ) įield productPriceField = new Field("productPrice", product.Price,, ) ĭocument.Add(productCategorySynonymField) ĭocument.Add(productDescriptionShortField) ![]() IndexWriter indexWriter = new IndexWriter(GetDirectory(id), analyzer, Private void BuildIndicesForLanguage(List products, Analyzer analyzer, int id = 0) List allProducts = db.GetAllProducts(true, false) īuildIndicesForLanguage(allProducts, analyzer, l.ID) Private const Version = .LUCENE_30 Īnalyzer analyzer = new StandardAnalyzer(Version) I think it has something to do with the way I save the fields to a document. Right now, my search query is productName:asterisk(input)asterisk - I can't imagine this is what you're supposed to do to find all products where productName contains input. My code currently works, however, I think I am not correctly making use of Lucene. I've been trying to implement Lucene to make the searching on my website faster.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |