|
Rank: Advanced Member
Groups: Registered
Joined: 9/1/2010 Posts: 136
|
I have developed the following code so far to generate a product index in a standalone VB.NET program:
Dim ProdConfig As New Configuration ProdConfig.IndexDirectory = IndexFolderPath ProdConfig.Logging = True
Dim ProdIndex As New Index.DocumentIndex(ProdConfig)
SqlStatement = "SELECT TOP 1000 ProductID, Author, CatalogText, Title, WebText " & _ "FROM Products WITH (NOLOCK) " & _ "WHERE ProductID >= 1000 " & _ "ORDER BY Title"
Dim ProdTable As DataTable = ScSql.Table(ScSql.ConnectionString(SqlServerName, ProductsDbName), SqlStatement)
If ProdTable IsNot Nothing Then With ProdTable NumProducts = .Rows.Count If NumProducts > 0 Then For I = 0 To NumProducts - 1 With .Rows(I) AuthorStr = .Item("Author").ToString CatalogText = .Item("CatalogText").ToString ProductID = CInt(.Item("ProductID").ToString) TitleStr = .Item("Title").ToString WebText = .Item("WebText").ToString End With
NavigateUrl = IndexDomain & ScProducts.DetailPageNavUrl(ProductID, , False)
TextStr = TitleStr & " " & AuthorStr & " " & CatalogText & " " & WebText TextStr = ConvertIndexText(TextStr)
If WebText <> "" Then SummaryStr = WebText Else SummaryStr = CatalogText End If
ProdIndex.AddDocument(New Documents.PreloadedDocument(New Uri(NavigateUrl), TitleStr, TextStr, SummaryStr, Nothing, Nothing, CustomData, ProdConfig)) Next I End If End With End If
ProdIndex.Optimize()
ProdIndex.Close()
It executes without errors and generates what looks like valid index data in the index folder. I have several questions:
1. It doesn't write out a configuration file. Is it possible to have it save this file?
2. When I use the Keyoti Index Manager Tool and specify the index folder and then try a sample search, it always returns no results. Should I be able to test this index this way?
3. The text for the PreloadedDocument is coming from a concatenated set of fields from the database. I had to write my own conversion function to strip out anything but alphanumeric characters. Is there a standard Keyoti function that would do this?
Thanks for your help!
|
|
Rank: Advanced Member
Groups: Registered
Joined: 9/1/2010 Posts: 136
|
I don't want to be pushy, but since I haven't received a reply, I was wondering if I should break my questions into separate posts. Thanks again for your help!
|
|
Rank: Advanced Member
Groups: Administrators, Registered
Joined: 8/13/2004 Posts: 2,669 Location: Canada
|
I am sorry, somehow I missed your post on Friday and didn't notice it on Monday. 1. To read/write the config file please see http://keyoti.com/produc...Guide/Configuration.htm
2. Yes you should be able to. If you look at the document list (in Index Manager), are there entries that you expect? If you right click on one of the rows, you can choose "More Information" which opens another form that will show the text that it indexed (at the bottom) - did it index any text? 3. No there isn't, but what kind of things did you strip out? You mean nonsense characters like you see when you open a binary file in a text editor? Thanks for the reminder for your post. Best Jim -your feedback is helpful to other users, thank you!-your feedback is helpful to other users, thank you!
|
|
Rank: Advanced Member
Groups: Registered
Joined: 9/1/2010 Posts: 136
|
Thanks, Jim, for your helpful feedback!
1. Your documentation did what I wanted.
2. Maybe I'm using an older version (Search for ASP.NET 2010), but I don't see anywhere to right click and choose "More Information." It says there were 2000 documents indexed (the number of sample records I selected from my SQL table), but I can't see anything more than a list of the URLs.
3. I strip out everything but letters and numbers. It was giving an error on a title that had a period in it (which I couldn't imagine would cause it grief), and the only way I could get it to work was to retain only the alphanumeric characters. Maybe this is related to another post I just made a few minutes ago about a specified argument out of range of valid values.
Sincerely, Dan
|
|
Rank: Advanced Member
Groups: Administrators, Registered
Joined: 8/13/2004 Posts: 2,669 Location: Canada
|
Dan, yes I'm talking about 2012, so that's why you don't have that option. Let's hold off on this thread until we see if the newer build resolves it. Jim -your feedback is helpful to other users, thank you!-your feedback is helpful to other users, thank you!
|
|