@@ -0,0 +1,3793 @@
+package org.apache.lucene.search;%0A%0A/* ====================================================================%0A * The Apache Software License, Version 1.1%0A *%0A * Copyright (c) 2001 The Apache Software Foundation.  All rights%0A * reserved.%0A *%0A * Redistribution and use in source and binary forms, with or without%0A * modification, are permitted provided that the following conditions%0A * are met:%0A *%0A * 1. Redistributions of source code must retain the above copyright%0A *    notice, this list of conditions and the following disclaimer.%0A *%0A * 2. Redistributions in binary form must reproduce the above copyright%0A *    notice, this list of conditions and the following disclaimer in%0A *    the documentation and/or other materials provided with the%0A *    distribution.%0A *%0A * 3. The end-user documentation included with the redistribution,%0A *    if any, must include the following acknowledgment:%0A *       %22This product includes software developed by the%0A *        Apache Software Foundation (http://www.apache.org/).%22%0A *    Alternately, this acknowledgment may appear in the software itself,%0A *    if and wherever such third-party acknowledgments normally appear.%0A *%0A * 4. The names %22Apache%22 and %22Apache Software Foundation%22 and%0A *    %22Apache Lucene%22 must not be used to endorse or promote products%0A *    derived from this software without prior written permission. For%0A *    written permission, please contact apache@apache.org.%0A *%0A * 5. Products derived from this software may not be called %22Apache%22,%0A *    %22Apache Lucene%22, nor may %22Apache%22 appear in their name, without%0A *    prior written permission of the Apache Software Foundation.%0A *%0A * THIS SOFTWARE IS PROVIDED %60%60AS IS'' AND ANY EXPRESSED OR IMPLIED%0A * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES%0A * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE%0A * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR%0A * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,%0A * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT%0A * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF%0A * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND%0A * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,%0A * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT%0A * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF%0A * SUCH DAMAGE.%0A * ====================================================================%0A *%0A * This software consists of voluntary contributions made by many%0A * individuals on behalf of the Apache Software Foundation.  For more%0A * information on the Apache Software Foundation, please see%0A * %3Chttp://www.apache.org/%3E.%0A */%0A%0Aimport junit.framework.TestCase;%0Aimport org.apache.lucene.store.Directory;%0Aimport org.apache.lucene.store.RAMDirectory;%0Aimport org.apache.lucene.index.IndexWriter;%0Aimport org.apache.lucene.index.Term;%0Aimport org.apache.lucene.analysis.*;%0Aimport org.apache.lucene.document.Document;%0Aimport org.apache.lucene.document.Field;%0A%0Apublic class TestPhraseQuery extends TestCase %7B%0A    public void testOrderDoesntMatter() throws Exception %7B%0A        Directory directory = new RAMDirectory();%0A        IndexWriter writer = new IndexWriter(directory, new WhitespaceAnalyzer(), true);%0A        Document doc = new Document();%0A        doc.add(Field.Text(%22field%22, %22one two%22));%0A        writer.addDocument(doc);%0A        writer.optimize();%0A        writer.close();%0A%0A        IndexSearcher searcher = new IndexSearcher(directory);%0A        PhraseQuery query = new PhraseQuery();%0A        query.setSlop(5);%0A        query.add(new Term(%22field%22, %22two%22));%0A        query.add(new Term(%22field%22, %22one%22));%0A        Hits hits = searcher.search(query);%0A        assertEquals(1, hits.length());%0A        searcher.close();%0A    %7D%0A%7D%0A

Test for PhraseQuery to show that order does not matter