namazu-users-en
[Top] [All Lists]

Re: Symbol matching

2001-05-07 23:19:40
On Mon, 7 May 2001, NOKUBI Takatsugu wrote:

Hmm, it should be more easy that you modify src/namazu-cgi.c, like the
following:

I thought it better to do this in query.c (nmz_make_query)

      strcpy(query.str, querystring);
+     /* Get rid of ? - _ , ; and : */
+     nmz_tr(query.str, "?-_,;:", "      ");
  
      set_phrase_trick(query.str);


By the way, there is a perl module named Search::Namazu.
<http://www.namazu.org/~knok/Search-Namazu-0.13.tar.gz>
It is a perl interface for libnmz.

Thanks.  Will check it out.

Also, is there any way to change the default matching from AND to OR?

I managed to do it by making three changes.  Sorry that I can't give a
patch because I don't have original source with me:

In parser.c: andop(void)

      if (strcmp(token, LP_STRING) == 0)
          return AND_OP;
-     if (!nmz_is_query_op(token))
-        return AND_OP;
      return 0;

      if (strcmp(token, LP_STRING) == 0)
          return AND_OP;
+ /*    if (!nmz_is_query_op(token))
+         return AND_OP;*/
      return 0;


Then, in orop(void):

          Cp++;
          return 1;
      }
+     if (!nmz_is_query_op(token)) {
+         return 2;
+     }


in nmz_expr(void):

      NmzResult left, right;
  
      left = term();
      if (left.stat != SUCCESS)
          return left;
-     while (orop()) {
          right = term();


      NmzResult left, right;
!     int op=0;

      left = term();
      if (left.stat != SUCCESS)
          return left;
+     while ((op=orop())) {
          right = term();
!         if(op==2)
!             Cp++;


Hope this helps anyone else who wants to do the same.

Philip


-- 
You know what we need, Hobbes? We need an attitude. Yeah, you can't be cool
if you don't have an attitude.    
                -- Calvin


Visit my webpage at http://www.ncst.ernet.in/~philip/
Read my writings at http://www.ncst.ernet.in/~philip/writings/

  MSN  philiptellis                         Yahoo!  philiptellis
  AIM  philiptellis




<Prev in Thread] Current Thread [Next in Thread>