Page 1 of 1

Search Parameters from a .txt file

Posted: Wed Jun 29, 2011 11:35 am
by altica
Is there a way to have search parameters read from a text file rather than from the Search Channel setup parameters?

This would be really useful as I could then generate the text file dynamically from another application

Re: Search Parameters from a .txt file

Posted: Wed Jun 29, 2011 1:00 pm
by support
altica wrote:Is there a way to have search parameters read from a text file rather than from the Search Channel setup parameters?

This would be really useful as I could then generate the text file dynamically from another application

Not really but you can always hack up the .CHANNEL file. Just make sure Awasu is not running when you do this.

Re: Search Parameters from a .txt file

Posted: Wed Jun 29, 2011 1:52 pm
by altica
Where do I find the .CHANNEL file?

Re: Search Parameters from a .txt file

Posted: Wed Jun 29, 2011 2:32 pm
by support
altica wrote:Where do I find the .CHANNEL file?

Awasu's file structure is described here.

Re: Search Parameters from a .txt file

Posted: Wed Jun 29, 2011 2:34 pm
by support
support wrote:you can always hack up the .CHANNEL file.

/taka hangs his head in shame.

You can also use the Awasu API to manipulate channels.

Old habits die hard :oops:

Re: Search Parameters from a .txt file

Posted: Wed Jun 29, 2011 2:47 pm
by altica
Awasu API Search Operations seems the way to go - just need to create a client to do this!

Do you think it's possible using Excel & VBA?

Re: Search Parameters from a .txt file

Posted: Wed Jun 29, 2011 6:12 pm
by support
altica wrote:Do you think it's possible using Excel & VBA?

Should be fine. As long as you can send an HTTP request and read the response, you should be OK to go.

Re: Search Parameters from a .txt file

Posted: Wed Jun 29, 2011 7:32 pm
by altica
Got Excel to talk to Awasu API using VBA. Couldn't figure out how to use Token so turned it off in Awasu

The command I send is : http://localhost:2604/channels/list

I assumed the same using the token would be:

http://localhost:2604/token?t=XXXX/channels/list but it doesn't seem to work

Could you let me know the format please?

PS I think this has huge potential!

Re: Search Parameters from a .txt file

Posted: Thu Jun 30, 2011 12:35 am
by support
altica wrote:http://localhost:2604/token?t=XXXX/channels/list but it doesn't seem to work

It should be http://localhost:2604/channels/list?token=XXXX

Re: Search Parameters from a .txt file

Posted: Thu Jun 30, 2011 11:11 am
by altica
Thanks for that - I'm getting there slowly!

What is the fortmat for the minScore command? Is it sent to the Awasu API as a separate string or is it tagged to the end of a search command?


I've tried:

http://localhost:2604/search/minScore=40

and

http://localhost:2604/search/query?ms=40


but neither seem to work

Re: Search Parameters from a .txt file

Posted: Thu Jun 30, 2011 11:47 am
by support
The Awasu API is fairly sophisticated and complex, so trial and error is going to be slow going :-)

If you want to change a channel's setting, first use $channels/list to find out what channels are in your Awasu and their ID's.

Then, call $channels/update, specifying the ID(s) of the channel(s) you want to update (in the URL parameters), and what settings you want to change (in the HTTP POST data). In your case, if you want to change the min score setting, you need to include a <scoreCutoff> tag.

To find out the format of the XML that needs to go in the HTTP POST data, call $channels/list with a verbose=1 parameter, to get the full details for each channel. The XML structure that is returned is the same structure you need to submit when either creating new channels, or updating existing ones.

Some examples here.

Re: Search Parameters from a .txt file

Posted: Thu Jun 30, 2011 12:03 pm
by altica
Hi

Not sure if this answers my question.

Your documentation for $/search/query details minScore (ms) Minimum score for search results (0-100)

How do I use this in an API call which seraches the Awasu database?

Re: Search Parameters from a .txt file

Posted: Thu Jun 30, 2011 12:19 pm
by support
altica wrote:How do I use this in an API call which seraches the Awasu database?

Ah, sorry. Your OP was talking about modifying search channel configurations so that's what I answered about :-)

The general format of a URL that accepts parameters is

Code: Select all

http://foobar.com?arg1=val1&arg2=val2&arg3=val3...etc...

So, to run an Awasu search, you could submit something like this:

Code: Select all

http://localhost:2604/search/query?q=bananas&minScore=40&pageSize=20

Re: Search Parameters from a .txt file

Posted: Thu Jun 30, 2011 12:34 pm
by altica
Thanks for that - the world is at peace once more!

Re: Search Parameters from a .txt file

Posted: Thu Jun 30, 2011 1:39 pm
by support
altica wrote:the world is at peace once more!

Ah, if only my life were so simple.

Sigh...