problem when using search by keyword
Brought to you by:
peterbe
Hello,
I have a problem when trying to search an issue using a
keyword. When I introduce the keyword, it returns me
the correct issues. But when I click on the link I want
to read, it send me to an error CMF page.
The error is:
---------------------------------------------------
Site Error
An error was encountered while publishing this resource.
Error Type: TypeError
Error Value: expected string or buffer
-----------------------------------------------------
Any help would be appreciated
Regards,
rtorres
Logged In: YES
user_id=208160
What's a "keyword"? An example?
Logged In: YES
user_id=314969
This is an example of what I call a search by keyword:
If I want to look for all the issues that are related to the
accounting software, I go to the text form that is next to
the "search" button and write "accounting".
When I do this, the program returns the issues that are
related to the search, but when I click on the links, I receive
the errors described above.
Regards,
rtorres
Logged In: YES
user_id=208160
Hm...
It's strange because the "sections" have nothing to do with
the search. I have a section called "General" and another
called "Issuetracker-development". Searching for those words
doesn't do anything special.
I think it's because that the HighlightQ() method doesn't
work on the text-keyword combination you have.
Can you perhaps email me the keyword you use to reproduce
the error and the issue (should be able to just export it)?
Logged In: YES
user_id=314969
The attach I'm adding to this comment contains screenshots
that could make the problem I have easier to understand.
Other fact I noticed that could be related to the problem is
that the links that result from the search (the ones that
present the problem) are like the following:
http://intranet.test.com/issuetrackers/tracker/0011?q=printer
The argument "?q=printer" only appears in links that results
from a search by word (in this case, the word is
''printer''). When the search is made by using "complete
list" or "List Issues", what appears is the link without
that last argument. I guess this link is an index to the
word I'm looking at inside the issue text.
Any help would be appreciate,
rtorres
screenshots
Logged In: YES
user_id=208160
Thank you for the screenshot. Great.
Can you maybe give me the traceback of the error?
Could you also please give me the issue (0011 as you say in
the url)?
Yes, the ?q=printer bit just brinks that word along to when
you view the issue.
You can go to
http://intranet.test.com/issuetrackers/tracker/00xyz
and then look for a word that appears in the title or body
and append "?q=someword" to the URL.
Say, do you get this error on ALL search terms or is it just
the combination "printer" with a specfic issue?
The HighlightQ() method might be broken in this particular case.
Logged In: YES
user_id=314969
Well,
I receive the error with every search term.
If I go directly to the URL
http://intranet.test.com/issuetrackers/tracker/00xyz , I
without problems. If I add the "?q=word" to the URL, The
error comes back.
Where is the traceback of that error? in Z2.log???
Logged In: YES
user_id=208160
If you're running > zope 2.6.x you have an object in the
zope root called error_log which logs all errors. Inspect
that and tell me.
error traceback
Logged In: YES
user_id=314969
The error traceback has been uploaded.
Logged In: YES
user_id=208160
We'll need to go deeper. The sourcecode has changed since
the version you use. Could you perhaps install the latest
version (i.e. 0.5.1) and run it again refreshed and inspect
again what the error becomes.
Also, can you edit the source code a little bit before you
do that?
There's a method called HighlightQ() which looks like this::
def HighlightQ(self, text, q=None, highlight_html=None):
""" Highlight a piece of a text from q """
if highlight_html is None:
highlight_html = '<span
class="q_highlight">%s</span>'
if q is None:
# then look for it in REQUEST
q = self.REQUEST.get('q',None)
...more code
Can you edit the begining of the code so that it looks like
this::
def HighlightQ(self, text, q=None, highlight_html=None):
""" Highlight a piece of a text from q """
print "DEBUG text=", text
print "DEBUG q=", q
print "DEBUG highlight_html=", highlight_html
if highlight_html is None:
highlight_html = '<span
class="q_highlight">%s</span>'
if q is None:
# then look for it in REQUEST
q = self.REQUEST.get('q',None)
print "DEBUG q REQUEST=", q
...more code
Then it would print to stdout what the values of these
variables become.
So what are the output and what is the line that causes the
error exactly.
Ruben, we have to solve this! :)
Logged In: YES
user_id=314969
Hello Peterbe,
Here are the results of the test you ask me to do, a little
late.
--------------------------------------------------
DEBUG text= ()
DEBUG q= None
DEBUG highlight_html= None
DEBUG q REQUEST= rtorres
DEBUG text= ()
DEBUG q= None
DEBUG highlight_html= None
DEBUG q REQUEST= rtorres
---------------------------------------------------------
I figured it out something. Right now, The issuetracker
instance that is giving me problems, is inside a Plone site
object.
If a put an issuetracker instance in the root folder of
zope, the issuetracker search works perfect.
The thing is that I need the issue tracker instance to be
where it is because of my apache configuration.
I hope the solution to this problem doesn't include to keep
the issuetracker out of the plone object