Note that this expects ISO language code (e.g., `de` for German)
<span class="term">Author: <input id="aut" type="text"/></span>
<span class="term">Title: <input id="tit" type="text"/></span>
<span class="term">Series: <input id="ser" type="text"/></span>
<span class="term">Author: <input id="aut" type="text"/></span>
<span class="term">Title: <input id="tit" type="text"/></span>
<span class="term">Series: <input id="ser" type="text"/></span>
+ <span class="term">Language: <input id="lan" type="text"/></span>
</form>
<div class="pager">
</form>
<div class="pager">
var my = {},
booksModel = undefined;
var my = {},
booksModel = undefined;
- const terms = ['aut', 'tit', 'ser'];
+ const terms = ['aut', 'lan', 'ser', 'tit'];
// ==============
// Public methods
// ==============
// Public methods
DDC string // Dewey Decimal Classification
Description string // Back cover / inside flap blurb, describing the book
Genre string // e.g. "adventure", "historical", "mystery", "romance", "sf" (Science Fiction)
DDC string // Dewey Decimal Classification
Description string // Back cover / inside flap blurb, describing the book
Genre string // e.g. "adventure", "historical", "mystery", "romance", "sf" (Science Fiction)
LCC string // Library of Congress Classification
SeriesName string
Title string
LCC string // Library of Congress Classification
SeriesName string
Title string
// ---------------------------------------------------------------------------
type Field string
const (
// ---------------------------------------------------------------------------
type Field string
const (
- Author, Series, Title Field = "aut", "ser", "tit"
+ Author, Language, Series, Title Field = "aut", "lan", "ser", "tit"
)
func (f Field) String() string {
)
func (f Field) String() string {
}
func queryBooksByIds(ids []int) []Book {
}
func queryBooksByIds(ids []int) []Book {
- query := `SELECT s.age,a.grouping,a.reading,a.sort,b.cover,c.ddc,b.description,s.genre,c.lcc,s.descr,b.title,b.volume
+ query := `SELECT s.age,a.grouping,a.reading,a.sort,b.cover,c.ddc,b.description,s.genre,b.language,c.lcc,s.descr,b.title,b.volume
FROM Authors a
INNER JOIN Books b ON a.id=b.author
LEFT OUTER JOIN Classifications c ON c.id=b.classification
FROM Authors a
INNER JOIN Books b ON a.id=b.author
LEFT OUTER JOIN Classifications c ON c.id=b.classification
- var age, grouping, reading, sort, ddc, description, genre, lcc, name, title, volume sql.NullString
+ var age, grouping, reading, sort, ddc, description, genre, language, lcc, name, title, volume sql.NullString
- err = row.Scan(&age, &grouping, &reading, &sort, &cover, &ddc, &description, &genre, &lcc, &name, &title, &volume)
+ err = row.Scan(&age, &grouping, &reading, &sort, &cover, &ddc, &description, &genre, &language, &lcc, &name, &title, &volume)
if err != nil {
report("Error: Failed to read book:" + strconv.Itoa(id) + ":", err)
} else {
if err != nil {
report("Error: Failed to read book:" + strconv.Itoa(id) + ":", err)
} else {
b.DDC = nsVal(ddc)
b.Description = nsVal(description)
b.Genre = nsVal(genre)
b.DDC = nsVal(ddc)
b.Description = nsVal(description)
b.Genre = nsVal(genre)
+ b.Language = nsVal(language)
b.LCC = nsVal(lcc)
b.SeriesName = nsVal(name)
b.Title = nsVal(title)
b.LCC = nsVal(lcc)
b.SeriesName = nsVal(name)
b.Title = nsVal(title)
case Author:
query += " UPPER(a.grouping) LIKE UPPER($" + strconv.Itoa(i + 1) + ")"
text = strings.Replace(text, " ", "", -1) // Remove spaces
case Author:
query += " UPPER(a.grouping) LIKE UPPER($" + strconv.Itoa(i + 1) + ")"
text = strings.Replace(text, " ", "", -1) // Remove spaces
+ case Language:
+ query += " UPPER(b.language) LIKE UPPER($" + strconv.Itoa(i + 1) + ")"
case Series:
query += " UPPER(s.descr) LIKE UPPER($" + strconv.Itoa(i + 1) + ")"
case Title:
case Series:
query += " UPPER(s.descr) LIKE UPPER($" + strconv.Itoa(i + 1) + ")"
case Title:
func handleSearch(w http.ResponseWriter, r *http.Request) {
var err error
func handleSearch(w http.ResponseWriter, r *http.Request) {
var err error
- fields := []Field{Author, Title, Series}
+ fields := []Field{Author, Language, Series, Title}
terms := make([]SearchTerm, len(fields))
terms := make([]SearchTerm, len(fields))