Python API Query Issues

Hi all,

Not sure if this is the right forum for Redisearch/Python related issues, but I’m at my wits end here. I’m trying to query the database for a web app that I’m currently developing, but the format of the return that I get from the database is giving me some issues. It does return the needed data, but I also get field information, symbols, etc, that is stopping me from successfully referencing the data into a usable form. Additionally, it seems to be stopping my HTML from marking up the data successfully, which will be a problem when I need to integrate links into the documents. Does anyone have ideas on how to return only text that is actually in the fields?

client = Client(‘idx’)
client.search(Doe)

Result{1 total, docs:[Document {‘mac’:123456’, ‘id’:‘12345’, ‘name’: ‘John Doe’, 'payload: None}]}

``

Any help would be appreciated!

Can you give me an example of what you want returned? Maybe the summarize/highlight option would be to your liking?

Regards
Mark Nunberg | Senior Software Engineer
Redis Labs - home of Redis

Email: mark@redislabs.com

Hi Mark,

I would like to only return the value from the field/fields I’m querying. For instance, have a document with a name John Doe, but when I query “Doe”, it returns the string that I posted above. Summarize reduces the length of the values that it returns (ei. 12345 instead of 1234567), but it still returns the extra words. Highlight puts the values between HTML headers, but for whatever reason HTML misses those in the markup, possibly due to the brackets that surrounds it. Please let me know if you have any other ideas!

So you’d basically only like the document to return the fields which contain the actual matching term and nothing else. You can provide different separators for HIGHLIGHT (HIGHLIGHT … TAGS …), so it doesn’t have to be a , or even HTML at all. You can have a pretty unambiguous TAGS “BEGIN_MATCHED_TERM” “END_MATCHED_TERM". Maybe you can play around with that.

Mark Nunberg | Senior Software Engineer
Redis Labs - home of Redis

Email: mark@redislabs.com