Re: [greenstone-devel] Context Search?

From Michael Dewsnip
DateTue, 07 Jun 2005 13:03:07 +1200
Subject Re: [greenstone-devel] Context Search?
In-Reply-To (e1c4358d05060610285584eacd-mail-gmail-com)
Hi Bradley,

One thing you might have missed is escaping the query URL. "&" and ":"
characters will need escaping in your query string, so instead of

&q=Wants&[Sufficiency]:SU

you would need

&q=Wants%26[Sufficiency]%3ASU

Let me know if this doesn't solve your problem and I'll look into it
further.

Regards,

Michael

Bradley Wangia wrote:

>I've followed the suggested steps outlined for context search to no avail
>1. Set up hierarchy classifier based on the subject
> Used MGPP by enabling advanced searching in GLI
> Set up ex.subject and text in the index
>2. I've changed the interface to only display the form on the
>appropriate pages.
>3. I've used javascript to find out which node is open.
>4. I've also used javascript to create a search string that appends the
> keywords entered by the user to the normal search string
> &q=Wants&[Sufficiency]:SU
>
>However, my searches return results that are global to the collection.
>I've experimented with my form's hidden fields the current settings are
>
><form name=QueryForm method=get
>onsubmit="window.open(buildQueryURL(this.q1.value, this))" action="">
><input type=hidden name="a" value="q">
><input type=hidden name="r" value="1">
><input type=hidden name="b" value="1">
><input type=hidden name="hs" value="1">
><input type=hidden name="e"
>value="p-0-00-ssl--00-1-0--0prompt-10---4------0-1l--1-en-50---20-about---00011-001-1-0utfZz-8-00">
><table align="right">
><tr><td> Search documents in this category</td></tr>
><tr><td>
><tr><td><nobr><input name="q1" type="text" id="tbox" value="" size="25">
></td></tr>
><tr><td>
>
><input type="submit" value="Begin Search" ></nobr>
>
></td></tr></table>
>
></form>
><!-- end of query form -->
>
>I suspect that my compressed arguments, e, is the cause of my undoing.
>How do I decipher compressed arguments ...
>
>Also could I use cgiargcl to tell the search engine where in the
>hierarchy to find the document I am searching for?
>
>
>On 5/17/05, Katherine Don <kjdon@cs.waikato.ac.nz> wrote:
>
>
>>Hi Bradley
>>
>>This is not something that we currently support. However, we think you
>>should be able to implement it by doing something like the following
>>example.
>>
>>The example is a subject hierarchy based on dc.Subject metadata, which,
>>once the user has browsed to a node, they can search the full text of
>>documents in that node for some terms which they enter.
>>
>>1. set up the collection classifiers and indexes.
>>You'll need a hierarchy classifier on dc.Subject.
>>for the indexes, you'll need to use mgpp - in the GLI, enable advanced
>>searching. you need to have dc.Subject and text in the index.
>>
>>2. change the interface. You'll need to add a little search form onto
>>the classifier page - in gsdl/macros/document.dm, in the _content_
>>macro, add eg
>>_If_("_cgiargd_" eq "",_myqueryform_)
>>then _myqueryform_ contains the content of the query form.
>>document.dm is used for displaying documents and classifiers, so you
>>need to test the d arg to make sure you are not in a document.
>>
>>You can decide what your query form looks like - look at the source of
>>the plain query page (in a mgpp collection) for what it might look like.
>>But the one thing you need is to add in the subject specification to the
>>query. You will need to use javascript for this.
>>
>>you want the value of the node that is opened in the subject field.
>>eg if you are open at a node titled "farming practice", you need
>>[farming practice]:SU added to the query
>>where SU is the short code for the dc.Subject index - you can check what
>>the short code is by looking in index/build.cfg file in your collection.
>>
>>If you want the search to be on text, then the final query might look like
>><keywords entered by user> & [farming practice]:SU
>>or if you want the search to be on a different field, add the field
>>specifier to the keywords:
>>[<keywords entered by user>]:TI & [farming practice]:SU
>>(this field must also be specified in the index specification)
>>I think you also need b=1 as a hidden arg.
>>and there might be others
>>
>>So, the last problem is how to get the value of the node thats open. I
>>can't think of anyway to get this without editing the c++ source code.
>>If you know javascript well, you may be able to get it by looking at the
>>contents of the page and somehow working out which table row is the
>>opened node.
>>Otherwise, probably the easiest thing to do is to have the c++ code
>>create a new macro, eg _currentnodevalue_, then you can use this in your
>>search form: [_currentnodevalue_]:SU
>>
>>edit the file src/recpt/documentaction.cpp. In define_internal_macros
>>
>>add just after the following (about line 850)
>> } else {
>> if (!arg_cl.empty()) {
>>
>> if (get_info (arg_cl, collection, args["l"], metadata, false,
>>collectproto, response, logout)) {
>> text_t &title = response.docInfo[0].metadata["Title"].values[0];
>> disp.setmacro ("currentnodevalue", "document", title);
>> }
>>
>>Then you'll need to recompile. see gsdl/Install.txt for details.
>>
>>So anyway, have a go, and let us know how you get on.
>>
>>Regards,
>>Katherine Don
>>
>>
>>Bradley Wangia wrote:
>>
>>
>>>One of the user requirements for a digital library that I am building
>>>is that the user should be able to browse the hierarchy and then once
>>>they have narrowed down their list of possibilities, they can search
>>>the documents in this part of the hierarchy for documents that contain
>>>their keywords.
>>>
>>>I've been looking around at the collections that are out there and I
>>>am yet to find anything other than global search. Is this
>>>functionality available in greenstone?
>>>
>>>My intuition is that this may be possible but Im beginning to spend
>>>too much time searching for how to do it. Any ideas/comments would be
>>>greatly appreciated.
>>>
>>>bradley wangia
>>>global development and environment institute
>>>Tufts University
>>>
>>>_______________________________________________
>>>greenstone-devel mailing list
>>>greenstone-devel@list.scms.waikato.ac.nz
>>>https://list.scms.waikato.ac.nz/mailman/listinfo/greenstone-devel
>>>
>>>
>>>
>
>_______________________________________________
>greenstone-devel mailing list
>greenstone-devel@list.scms.waikato.ac.nz
>https://list.scms.waikato.ac.nz/mailman/listinfo/greenstone-devel
>
>
>