Return-Path: Delivered-To: apmail-couchdb-user-archive@www.apache.org Received: (qmail 35479 invoked from network); 13 Feb 2010 23:32:01 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 13 Feb 2010 23:32:01 -0000 Received: (qmail 61037 invoked by uid 500); 13 Feb 2010 23:32:00 -0000 Delivered-To: apmail-couchdb-user-archive@couchdb.apache.org Received: (qmail 60959 invoked by uid 500); 13 Feb 2010 23:31:59 -0000 Mailing-List: contact user-help@couchdb.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: user@couchdb.apache.org Delivered-To: mailing list user@couchdb.apache.org Received: (qmail 60949 invoked by uid 99); 13 Feb 2010 23:31:59 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Sat, 13 Feb 2010 23:31:59 +0000 X-ASF-Spam-Status: No, hits=1.5 required=10.0 tests=SPF_PASS,WEIRD_PORT X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: domain of mrtrick@gmail.com designates 209.85.216.204 as permitted sender) Received: from [209.85.216.204] (HELO mail-px0-f204.google.com) (209.85.216.204) by apache.org (qpsmtpd/0.29) with ESMTP; Sat, 13 Feb 2010 23:31:50 +0000 Received: by pxi42 with SMTP id 42so2534214pxi.5 for ; Sat, 13 Feb 2010 15:31:30 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:message-id:date:from :user-agent:mime-version:to:subject:references:in-reply-to :content-type:content-transfer-encoding; bh=JWPQTE8D+AwZYKNAg4TAv4ioU5StvjZIaVRTIzC78tM=; b=hwowSHlbSQYhEg5dSZhROPtivSI93YdnFa2SxzOP/no3nBnryEzPQb8aGn8ruWHo+G jE9t30kgU3nAWosgxHgFrK0omV56gaui30rciPyWEXZPHaqwRJ6PUUaPY5lnCQPyL75T uZDGXEimxI+etU003yjHd5eaL565sUinK5cBA= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:user-agent:mime-version:to:subject:references :in-reply-to:content-type:content-transfer-encoding; b=IaihRG3c7kMgsXPuvmykz0HOLmf1Y/FCfcE+nc2d/FqvIZE+lqZXfR9ZxDzoJRWrkw /sIHwMBClPNu5XD6y31HaML2lzaoQQF/l9lmEoFfUHNAY7VOxiJ8Mtk5ZlNAMLWYLZ/7 YJo6zjQF+7JIuSdVSPH8T+3FijeOtMx7IcPTI= Received: by 10.141.53.12 with SMTP id f12mr2168816rvk.188.1266103889533; Sat, 13 Feb 2010 15:31:29 -0800 (PST) Received: from ?192.168.1.99? (124-168-130-146.dyn.iinet.net.au [124.168.130.146]) by mx.google.com with ESMTPS id 22sm2290501pzk.5.2010.02.13.15.31.26 (version=TLSv1/SSLv3 cipher=RC4-MD5); Sat, 13 Feb 2010 15:31:28 -0800 (PST) Message-ID: <4B77363E.4060000@gmail.com> Date: Sun, 14 Feb 2010 10:31:10 +1100 From: Patrick Barnes User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.1.7) Gecko/20100111 Lightning/1.0b1 Thunderbird/3.0.1 MIME-Version: 1.0 To: user@couchdb.apache.org Subject: Re: couchdb-lucene fulltextsearch References: In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Read through the documentation at http://github.com/rnewson/couchdb-lucene (Keep scrolling further down the page) When you call rec.add() (And you can call add() more than once per function), there is an optional second argument to set the indexing options: The two that you'd probably find useful are: doc.add(doc.subject, {"field":"subject"}); If you explicitly name the field, your query must look like q=subject:Foo and doc.add(doc.subject, {"stored":"yes"}); This stores the value inside the result - so that it will be shown even without include_docs=true. (If you want the field shown but don't want to search on it, also add "index":"not_analyzed" to the options object.) The options are shown on the web page in the "The Defaults Object" table - further on are lots of examples. -Patrick On 14/02/2010 3:48 AM, km wrote: > Hi all, > I am working with couchdb v0.10.0 + couchdb-lucene v0.4 > I have a design document (from the docs) for a couchdb database with > fulltext search indexes > > { > "_id":"_design/lucene", > "_rev":" some rev id ... ", > > "fulltext":{ > "by_name":{ > "index":"function(doc){var rec = new Document(); rec.add(doc.name); > return rec;}" > } > } > } > > now using this, i query > curl http://localhost:5984/mydb/_fti/lucene/by_name?q='john' > > so far so good and I retrive one record like this > {"q":"john","etag":"126bc75d913","view_sig":"ffe984900a27786e627594907565e3aa","skip":0,"limit":25,"total_rows":1,"search_duration":0,"fetch_duration":0,"rows":[{"id":"0a08997ba60937ce49ed6b9b4eb11369","score":8.580954551696777}]} > > But how do I retrieve some of keys and their values from the documents > matched ? > Ofcourse I can attach an "include_docs=true" to the query param, But that > returns entire document to the client which is not desired - (big documents) > . > > > do I need to have a map function for this ? and where should i place it ? > pls enlighten. > > thanks > Krishna > ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ >