Ordering results by Rank

Posts   
 
    
jbliss1234
User
Posts: 42
Joined: 04-May-2007
# Posted on: 16-Feb-2012 02:05:53   

My client is asking for results of a search query to be ordered by relevance i.e. rank.

I am trying to figure out how to get rank returned in LLBLGen.

I see that there was a thread related to this in 2004 (http://www.llblgen.com/tinyforum/Messages.aspx?ThreadID=1648).

Is it possible to use FreeTextTable or some other mechanism to return rank?

daelmo avatar
daelmo
Support Team
Posts: 8245
Joined: 28-Nov-2005
# Posted on: 16-Feb-2012 06:10:00   

This is not supported by default. I cooked some custom code for this some time ago. It is in a private thread, so you can't see it. I'm attaching it to this post. There is a readme.txt file with instructions.

It was coded for LLBLGen v2.6, so if you are using v3.1 you will have to test it and migrate if needed. I think you will only have to modify the template file though.

I hope it would be helpful to you, at least as a starting point you can understand and modify.

Attachments
Filename File size Added on Approval
FullTextSearchExtensionPackage20090910.zip 15,969 16-Feb-2012 06:10.19 Approved
David Elizondo | LLBLGen Support Team
PeterHagen
User
Posts: 4
Joined: 20-Aug-2013
# Posted on: 20-Aug-2013 09:55:53   

Does anyone have this working on 3.5?

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39912
Joined: 17-Aug-2003
# Posted on: 20-Aug-2013 10:17:27   

The same extension attached to David's post will work on 3.5 as well.

Frans Bouma | Lead developer LLBLGen Pro
PeterHagen
User
Posts: 4
Joined: 20-Aug-2013
# Posted on: 20-Aug-2013 10:50:33   

Unfortunately I can't get it build. There are many messages like "there are no suitable methods to override", for example:

IRetrievalQuery queryTemp = base.CreateSelectDQ(selectList, fieldsPersistenceInfo, connectionToUse, selectFilter, maxNumberOfItemsToReturn, sortClauses, relationsToWalk, allowDuplicates, groupByClause, relationsSpecified, sortClausesSpecified);

Am I missing something?

PeterHagen
User
Posts: 4
Joined: 20-Aug-2013
# Posted on: 20-Aug-2013 11:25:43   

I guess I'm doing something wrong. In the tab (window / show template binding viewer) I see the "SD.TemplateBindings/SharedTemplates.FullTextSearchExtension.NET20". So, thats good. But then I go to "Generate source code" > "advanced" > "Template bindings", the fulltextsearchExtension is not there. How can I add it there?

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39912
Joined: 17-Aug-2003
# Posted on: 21-Aug-2013 13:57:44   

Oh, my bad! flushed , I assumed it was just a predicate, hence my remark about it should work. The actual code posted above is reworking the query a lot so it's not trivial to get that working on v3.x/v4.x code bases. (at least, it requires code changes). The code uses a changed DQE so it comes with changed templates.

I wonder however whether it's still needed to use a changed DQE for this in v3/4. Do you use adapter?

Frans Bouma | Lead developer LLBLGen Pro
PeterHagen
User
Posts: 4
Joined: 20-Aug-2013
# Posted on: 21-Aug-2013 13:58:40   

I use the adapter indeed

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39912
Joined: 17-Aug-2003
# Posted on: 21-Aug-2013 14:08:32   

PeterHagen wrote:

I use the adapter indeed

OK. In adapter, you can create a partial class of DataAccessAdapter, and override CreateSelectDQ. After the query has been created, you can manipulate it like the query is manipulated in the code attached to the posts above. This isn't trivial though. The main point is that the code in the DQE subclass in the code above, is now usable from the partial class and you can e.g. call it when a flag you add is set on the partial DataAccessAdapter class.

This at least avoids using a new DQE class and templates. If you get stuck with porting the code, please let us know.

Frans Bouma | Lead developer LLBLGen Pro