001    /**
002     * Copyright (c) 2000-present Liferay, Inc. All rights reserved.
003     *
004     * This library is free software; you can redistribute it and/or modify it under
005     * the terms of the GNU Lesser General Public License as published by the Free
006     * Software Foundation; either version 2.1 of the License, or (at your option)
007     * any later version.
008     *
009     * This library is distributed in the hope that it will be useful, but WITHOUT
010     * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
011     * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
012     * details.
013     */
014    
015    package com.liferay.portal.kernel.search;
016    
017    import com.liferay.portal.kernel.search.filter.BooleanFilter;
018    import com.liferay.portal.kernel.search.query.QueryVisitor;
019    
020    /**
021     * @author Michael C. Han
022     */
023    public abstract class BaseQueryImpl implements Query {
024    
025            @Override
026            public <T> T accept(QueryVisitor<T> queryVisitor) {
027                    return null;
028            }
029    
030            @Override
031            public float getBoost() {
032                    return _boost;
033            }
034    
035            @Override
036            public BooleanFilter getPreBooleanFilter() {
037                    return _preFilter;
038            }
039    
040            @Override
041            public QueryConfig getQueryConfig() {
042                    if (_queryConfig == null) {
043                            _queryConfig = new QueryConfig();
044                    }
045    
046                    return _queryConfig;
047            }
048    
049            /**
050             * @deprecated As of 7.0.0
051             */
052            @Deprecated
053            @Override
054            public Object getWrappedQuery() {
055                    return this;
056            }
057    
058            @Override
059            public boolean hasChildren() {
060                    return false;
061            }
062    
063            @Override
064            public boolean isDefaultBoost() {
065                    if (_boost == BOOST_DEFAULT) {
066                            return true;
067                    }
068    
069                    return false;
070            }
071    
072            @Override
073            public void setBoost(float boost) {
074                    _boost = boost;
075            }
076    
077            @Override
078            public void setPreBooleanFilter(BooleanFilter preFilter) {
079                    _preFilter = preFilter;
080            }
081    
082            @Override
083            public void setQueryConfig(QueryConfig queryConfig) {
084                    _queryConfig = queryConfig;
085            }
086    
087            private float _boost = BOOST_DEFAULT;
088            private BooleanFilter _preFilter;
089            private QueryConfig _queryConfig;
090    
091    }